public async Task Handle(Message message, IBusForHandler bus) { this.context.AsyncHandlerCalls += 1; await bus.Reply(new ReplyMessage { Answer = "AsyncMessageHandler" }); var options = new ReplyOptions(); options.Headers.Add("Key", "Value"); await bus.Reply(new ReplyMessage { Answer = "AsyncMessageHandlerWithHeaders" }, options); }
private static ReplyOptions GetOrCreateReplyOptions(TransportMessage incoming, ReplyOptions options = null) { Queue destination = incoming.ReplyTo; string correlationId = !string.IsNullOrEmpty(incoming.CorrelationId) ? incoming.CorrelationId : incoming.Id; if (options == null) { return(new ReplyOptions(destination, correlationId)); } options.Queue = options.Queue ?? destination; options.CorrelationId = options.CorrelationId ?? correlationId; return(options); }
public Task Reply(object message, ReplyOptions options = null) { ReplyOptions replyOptions = GetOrCreateReplyOptions(this.incoming, options); return(this.bus.Send(message, replyOptions, this.incoming)); }
private static ReplyOptions GetOrCreateReplyOptions(TransportMessage incoming, ReplyOptions options = null) { Queue destination = incoming.ReplyTo; string correlationId = !string.IsNullOrEmpty(incoming.CorrelationId) ? incoming.CorrelationId : incoming.Id; if (options == null) { return new ReplyOptions(destination, correlationId); } options.Queue = options.Queue ?? destination; options.CorrelationId = options.CorrelationId ?? correlationId; return options; }
public Task Reply(object message, ReplyOptions options = null) { ReplyOptions replyOptions = GetOrCreateReplyOptions(this.incoming, options); return this.bus.Send(message, replyOptions, this.incoming); }