Skip to content

Commit

Permalink
Merge pull request #11 from gamulka/Rebus-ReplyToOriginator-Extension
Browse files Browse the repository at this point in the history
Add ReplyToOriginator-Extension
  • Loading branch information
pruiz committed Sep 23, 2016
2 parents 5442751 + 97fb505 commit 62ec641
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions HermaFx.Rebus/RebusExtensions.cs
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;

using Rebus;
using Rebus.Shared;

namespace HermaFx.Rebus
{
Expand Down Expand Up @@ -52,5 +53,16 @@ public static void Reply<TResponse>(this IBus bus, Action<TResponse> customizer)

bus.Reply(message);
}

public static void ReplyTo<TMessage>(this IBus bus, string originator, string correlationId, TMessage message)
{
Guard.IsNotNull(bus, nameof(bus));
Guard.IsNotNullNorEmpty(originator, nameof(originator));
Guard.IsNotNullNorEmpty(correlationId, nameof(correlationId));
Guard.IsNotNull(message, nameof(message));

bus.AttachHeader(message, Headers.CorrelationId, correlationId);
bus.Advanced.Routing.Send(originator, message);
}
}
}

0 comments on commit 62ec641

Please sign in to comment.