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

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