Esempio n. 1
0
 public ReplyFactory(Type messageType,
     string exchange,
     CurrentMessageInformation currentMessage,
     byte[] body,
     Action<BasicReturn> basicReturnCallback,
     bool persistent)
     : base(messageType, persistent)
 {
     this.exchange = exchange;
     this.currentMessage = currentMessage;
     this.body = body;
     this.basicReturnCallback = basicReturnCallback;
 }
        public bool Invoke(IEnumerable<IConsumer> consumers, CurrentMessageInformation message)
        {
            foreach (var consumer in consumers)
            {
                log.TraceFormat("Invoking Consume method on consumer {0} for message {1}", consumer.GetType(), message.MessageType);

                try
                {
                    consumer.InvokePreservingStackTrace(message.Body);
                }
                catch (Exception e)
                {
                    log.Error("Exception while invoking consumer", e);
                }
            }

            return true;
        }