Пример #1
0
        public static BrokeredMessage BrokerGetMessage(AmqpMessage amqpMessage, bool shouldOptimizeForPassthrough)
        {
            BrokeredMessage brokeredMessage;

            if (!shouldOptimizeForPassthrough)
            {
                amqpMessage.Deserialize(SectionFlag.All);
                brokeredMessage = new BrokeredMessage(amqpMessage.GetNonBodySectionsStream(), true, amqpMessage.GetBodySectionStream(), true, BrokeredMessageFormat.Amqp);
            }
            else
            {
                amqpMessage.Deserialize(SectionFlag.Header | SectionFlag.DeliveryAnnotations | SectionFlag.MessageAnnotations | SectionFlag.Properties | SectionFlag.ApplicationProperties);
                brokeredMessage = new BrokeredMessage(null, false, amqpMessage.ToStream(), true, BrokeredMessageFormat.PassthroughAmqp);
            }
            if (amqpMessage.RawByteBuffers != null)
            {
                brokeredMessage.AttachDisposables(amqpMessage.RawByteBuffers.GetClones());
            }
            MessageConverter.UpdateBrokeredMessageHeaderAndProperties(amqpMessage, brokeredMessage);
            return(brokeredMessage);
        }