Exemple #1
0
        internal void DispatchBasicReturn(ushort replyCode, string replyText,
                                          string exchange, string routingKey, int bodySize,
                                          BasicProperties properties, BaseLightStream ringBufferStream)
        {
            var ev     = this.MessageUndeliveredHandler;
            var marker = new RingBufferPositionMarker(ringBufferStream);

            try
            {
                if (ev != null)
                {
                    var inst = new UndeliveredMessage
                    {
                        bodySize   = bodySize,
                        stream     = bodySize == 0 ? EmptyStream : ringBufferStream,
                        properties = properties,
                        routingKey = routingKey,
                        replyCode  = replyCode,
                        replyText  = replyText,
                        exchange   = exchange
                    };

                    ev(inst);
                }
            }
            finally
            {
                marker.EnsureConsumed(bodySize);
            }
        }
Exemple #2
0
        internal async Task DispatchBasicReturn(ushort replyCode, string replyText, string exchange, string routingKey,
                                                int bodySize, BasicProperties properties, Stream stream)
        {
            var ev = this.MessageUndeliveredHandler;

            // var consumed = 0;

            if (ev != null)
            {
                var inst = new UndeliveredMessage()
                {
                    bodySize   = bodySize,
                    stream     = stream,
                    properties = properties,
                    routingKey = routingKey,
                    replyCode  = replyCode,
                    replyText  = replyText,
                    exchange   = exchange
                };

                await ev(inst);
            }
        }