Esempio n. 1
0
        private void DoTestNMSMessageEncodingAddsProperMessageAnnotations(sbyte msgType, byte?toType, byte?replyToType)
        {
            AmqpNmsMessageFacade messageFacade = CreateMessageFacadeFromTypeId(msgType);
            IDestination         to            = CreateDestinationFromTypeId(toType);
            IDestination         replyTo       = CreateDestinationFromTypeId(replyToType);

            messageFacade.NMSDestination = to;
            messageFacade.NMSReplyTo     = replyTo;

            AmqpCodec.EncodeMessage(messageFacade);
            Assert.AreEqual(messageFacade.MessageAnnotations[SymbolUtil.JMSX_OPT_MSG_TYPE], msgType);

            if (toType != null)
            {
                Assert.True(messageFacade.MessageAnnotationExists(SymbolUtil.JMSX_OPT_DEST));
                Assert.AreEqual(messageFacade.GetMessageAnnotation(SymbolUtil.JMSX_OPT_DEST), toType.Value);
            }

            if (replyToType != null)
            {
                Assert.True(messageFacade.MessageAnnotationExists(SymbolUtil.JMSX_OPT_REPLY_TO));
                Assert.AreEqual(messageFacade.GetMessageAnnotation(SymbolUtil.JMSX_OPT_REPLY_TO), replyToType.Value);
            }
        }
Esempio n. 2
0
        public static IDestination GetReplyTo(AmqpNmsMessageFacade message, IAmqpConnection connection, IDestination consumerDestination)
        {
            string replyTo = message.ReplyToAddress;

            object typeAnnotation = message.GetMessageAnnotation(SymbolUtil.JMSX_OPT_REPLY_TO);

            if (typeAnnotation != null)
            {
                byte   type = Convert.ToByte(typeAnnotation);
                string name = StripPrefixIfNecessary(replyTo, connection, type);
                return(CreateDestination(name, type));
            }
            else
            {
                string name = StripPrefixIfNecessary(replyTo, connection);
                return(CreateDestination(name, consumerDestination, true));
            }
        }