Esempio n. 1
0
        protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
        {
            object result = SplitMessage(message);

            if (result == null)
            {
                return;
            }
            object correlationId = message.Headers.Id;

            if (result is ICollection)
            {
                ICollection items          = (ICollection)result;
                int         sequenceNumber = 0;
                int         sequenceCount  = items.Count;
                foreach (object item in items)
                {
                    AddReply(replyHolder, item, correlationId, ++sequenceNumber, sequenceCount);
                }
            }
            else if (result.GetType().IsArray)
            {
                object[] items          = (object[])result;
                int      sequenceNumber = 0;
                int      sequenceSize   = items.Length;
                foreach (object item in items)
                {
                    AddReply(replyHolder, item, correlationId, ++sequenceNumber, sequenceSize);
                }
            }
            else
            {
                AddReply(replyHolder, result, correlationId, 1, 1);
            }
        }
 protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
 {
     if (_selector.Accept(message))
     {
         replyHolder.Set(message);
     }
     else if (_throwExceptionOnRejection)
     {
         throw new MessageRejectedException(message);
     }
 }
Esempio n. 3
0
 protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
 {
     try {
         IMessage result = _transformer.Transform(message);
         if (result != null)
         {
             replyHolder.Set(result);
         }
     }
     catch (Exception e) {
         if (e is MessageTransformationException)
         {
             throw;
         }
         throw new MessageTransformationException(message, e);
     }
 }
        protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyMessageHolder)
        {
            if (!initialized)
            {
                AfterPropertiesSet();
            }
            IMessage requestMessage = MessageBuilder.FromMessage(message).Build();

            try
            {
                Apache.NMS.IMessage nmsReply = SendAndReceive(requestMessage);
            }
            catch (NMSException ex)
            {
                throw new MessageHandlingException(requestMessage, ex);
            }
        }
        protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
        {
            if (!(message.Payload is ISerializable))
            {
                throw new MessageHandlingException(message, GetType().Name + " expects a Serializable payload type " + "but encountered [" + message.Payload.GetType().Name + "]");
            }
            IMessage requestMessage = MessageBuilder.FromMessage(message).Build();

            try {
                IMessage reply = _handlerProxy.Handle(requestMessage);
                if (reply != null)
                {
                    replyHolder.Set(reply);
                }
            }
            catch (RemotingException e) {
                throw new MessageHandlingException(message, "unable to handle message remotely", e);
            }
        }
Esempio n. 6
0
 private static void AddReply(ReplyMessageHolder replyHolder, object item, object correlationId, int sequenceNumber, int sequenceSize)
 {
     replyHolder.Add(item).SetCorrelationId(correlationId).SetSequenceNumber(sequenceNumber).SetSequenceSize(sequenceSize);
 }
Esempio n. 7
0
 protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
 {
     replyHolder.Set(message.Payload.ToString().ToUpper());
 }
 protected override void HandleRequestMessage(IMessage message, ReplyMessageHolder replyHolder)
 {
     replyHolder.Set(message);
 }