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);
            }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
            public Task Reply(object message, ReplyOptions options = null)
            {
                ReplyOptions replyOptions = GetOrCreateReplyOptions(this.incoming, options);

                return(this.bus.Send(message, replyOptions, this.incoming));
            }
Exemplo n.º 4
0
            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;
            }
Exemplo n.º 5
0
 public Task Reply(object message, ReplyOptions options = null)
 {
     ReplyOptions replyOptions = GetOrCreateReplyOptions(this.incoming, options);
     return this.bus.Send(message, replyOptions, this.incoming);
 }