internal override async ValueTask ReadBodyMessage(RabbitMQDeliver deliver, ContentHeader header)
        {
            var headerResult = await _protocol.Reader.ReadAsync(new FrameHeaderReader()).ConfigureAwait(false);

            _protocol.Reader.Advance();
            _reader.Restart(header);

            while (!_reader.IsComplete)
            {
                var result = await _protocol.Reader.ReadAsync(_reader).ConfigureAwait(false);

                var chunk = new ChunkedConsumeResult(result.Message, _reader.IsComplete);
                Received?.Invoke(deliver, chunk);
                _protocol.Reader.Advance();
            }
        }
        internal override async ValueTask ReadBodyMessage(RabbitMQDeliver deliver, ContentHeader header)
        {
            var headerResult = await _protocol.Reader.ReadAsync(new FrameHeaderReader()).ConfigureAwait(false);

            _protocol.Reader.Advance();
            Restart(header);

            while (!_reader.IsComplete)
            {
                var result = await _protocol.Reader.ReadAsync(_reader).ConfigureAwait(false);

                Copy(result.Message);
                _protocol.Reader.Advance();
            }
            Received?.Invoke(deliver, _activeDeliver);
            ArrayPool <byte> .Shared.Return(_activeDeliver);

            _activeDeliver = null;
        }
Example #3
0
        public async ValueTask OnBeginDeliveryAsync(RabbitMQDeliver deliver, RabbitMQProtocolReader protocol)
        {
            var activeContent = await protocol.ReadAsync(_contentFullReader).ConfigureAwait(false);

            _activeDeliverBody = ArrayPool <byte> .Shared.Rent((int)activeContent.BodySize);

            _deliverPosition = 0;
            _bodyReader.Reset(activeContent.BodySize);

            while (!_bodyReader.IsComplete)
            {
                var result = await protocol.ReadWithoutAdvanceAsync(_bodyReader).ConfigureAwait(false);

                Copy(result);
                protocol.Advance();
            }

            var arg = new DeliverArgs(deliver.DeliverTag, activeContent, _activeDeliverBody);

            _scheduler.Schedule(Invoke, arg);
        }
 internal abstract ValueTask ReadBodyMessage(RabbitMQDeliver deliver, ContentHeader header);