Esempio n. 1
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);
        }