Exemplo n.º 1
0
 protected override void OnInitialize()
 {
     this.bodyData = AmqpMessage.ReadStream(this.bodyStream, 1024, out this.bodyLength);
     if (this.ownStream)
     {
         this.bodyStream.Dispose();
     }
 }
Exemplo n.º 2
0
            protected override void OnInitialize()
            {
                // mask off immutable sections except footer
                this.properties            = null;
                this.applicationProperties = null;
                this.footer = null;

                BufferListStream stream = this.messageStream as BufferListStream;

                if (stream != null && !this.ownStream)
                {
                    stream = (BufferListStream)stream.Clone();
                }
                else
                {
                    int length = 0;
                    ArraySegment <byte>[] buffers = AmqpMessage.ReadStream(this.messageStream, 512, out length);
                    stream = new BufferListStream(buffers);
                }

                AmqpMessageReader reader       = new AmqpMessageReader(stream);
                AmqpMessage       emptyMessage = AmqpMessage.Create();

                reader.ReadMessage(emptyMessage, SectionFlag.Header | SectionFlag.DeliveryAnnotations | SectionFlag.MessageAnnotations);
                this.UpdateHeader(emptyMessage.header);
                this.UpdateDeliveryAnnotations(emptyMessage.deliveryAnnotations);
                this.UpdateMessageAnnotations(emptyMessage.messageAnnotations);

                // read out the remaining buffers
                bool unused = false;

                this.buffers = stream.ReadBuffers(int.MaxValue, true, out unused);

                stream.Dispose();
                if (this.ownStream)
                {
                    this.messageStream.Dispose();
                }
            }