public Task Handle(ReplyMessage message, IBusForHandler bus)
            {
                this.context.ReplyHandlerCalls += 1;
                if (bus.Headers(message).ContainsKey("Key"))
                {
                    this.context.HeaderValue = bus.Headers(message)["Key"];
                }

                return(Task.FromResult(0));
            }
Пример #2
0
            public Task Handle(ReplyMessage message, IBusForHandler bus)
            {
                context.ReplyHandlerCalls += 1;
                if (bus.Headers(message).ContainsKey("Key"))
                {
                    context.HeaderValue = bus.Headers(message)["Key"];
                }

                return(Task.CompletedTask);
            }
        public Task Handle(object message, IBusForHandler bus)
        {
            IDictionary <string, string> headers = bus.Headers(message);

            var exceptionMessage = string.Format(CultureInfo.InvariantCulture, "The message with id {0} of type {1} has been rejected.", headers[HeaderKeys.MessageId], message.GetType());

            throw new InvalidOperationException(exceptionMessage);
        }
            public Task Handle(AsyncMessage message, IBusForHandler bus)
            {
                Debug.WriteLine("ASync {0}, delayed {1}", message.Bar, bus.Headers(message)[HeaderKeys.DelayedDeliveryCount]);
                if (message.Bar % 2 == 0)
                {
                    throw new InvalidOperationException();
                }

                this.context.HandlerCalled();
                return(Task.FromResult(0));
            }
Пример #5
0
            public Task Handle(Message message, IBusForHandler bus)
            {
                int    delayedDeliveryCount;
                string delayedDeliveryCountString;

                bus.Headers(message).TryGetValue(HeaderKeys.DelayedDeliveryCount, out delayedDeliveryCountString);
                int.TryParse(delayedDeliveryCountString, out delayedDeliveryCount);
                if (delayedDeliveryCount == actualDelayedRetryCount)
                {
                    throw new InvalidOperationException();
                }

                return(Task.FromResult(0));
            }
 public void Handle(Event message, IBusForHandler bus)
 {
     this.context.HandlerCalled       += 1;
     this.context.HandlerCaughtHeaders = bus.Headers(message);
 }
 public Task Handle(Event message, IBusForHandler bus)
 {
     this.context.AsyncHandlerCalled       += 1;
     this.context.AsyncHandlerCaughtHeaders = bus.Headers(message);
     return(Task.FromResult(0));
 }
Пример #8
0
 public Task Handle(Message message, IBusForHandler bus)
 {
     context.SecondHandlerCalls        += 1;
     context.SecondHandlerCaughtHeaders = bus.Headers(message);
     return(Task.CompletedTask);
 }
Пример #9
0
 public Task Handle(Message message, IBusForHandler bus)
 {
     context.SecondHandlerCalls        += 1;
     context.SecondHandlerCaughtHeaders = bus.Headers(message);
     return(Task.FromResult(0));
 }
            public void Handle(Message message, IBusForHandler bus)
            {
                Debug.WriteLine("{0}s: Sync {1}, delayed {2}", DateTime.Now.Subtract(startTime).Seconds, message.Bar, bus.Headers(message)[HeaderKeys.DelayedDeliveryCount]);
                if (message.Bar % 2 == 0)
                {
                    throw new InvalidOperationException();
                }

                this.context.HandlerCalled();
            }
Пример #11
0
 public Task Handle(Event message, IBusForHandler bus)
 {
     context.FirstHandlerCalls         += 1;
     context.FirstcHandlerCaughtHeaders = bus.Headers(message);
     return(Task.FromResult(0));
 }
Пример #12
0
 public Task Handle(Event message, IBusForHandler bus)
 {
     context.FirstHandlerCalls         += 1;
     context.FirstcHandlerCaughtHeaders = bus.Headers(message);
     return(Task.CompletedTask);
 }