Пример #1
0
        public NmsMessage CreateMessage()
        {
            AmqpNmsMessageFacade facade = new AmqpNmsMessageFacade();

            facade.Initialize(connection);
            return(facade.AsMessage());
        }
        public static INmsMessageFacade DecodeMessage(IAmqpConsumer consumer, global::Amqp.Message amqpMessage)
        {
            // First we try the easy way, if the annotation is there we don't have to work hard.
            AmqpNmsMessageFacade result = CreateFromMsgAnnotation(amqpMessage.MessageAnnotations);

            if (result == null)
            {
                // Next, match specific section structures and content types
                result = CreateWithoutAnnotation(amqpMessage.BodySection, amqpMessage.Properties);
            }

            if (result != null)
            {
                result.Initialize(consumer, amqpMessage);
                return(result);
            }

            throw new NMSException("Could not create a NMS message from incoming message");
        }