Exemplo n.º 1
0
        internal async ValueTask ProcessQueue(RabbitMQProtocolReader protocol, FrameHeader header, MethodHeader method, CancellationToken token = default)
        {
            switch (method.MethodId)
            {
            case 11:     //declare-ok
            {
                var declareOk = await protocol.ReadQueueDeclareOkAsync(token).ConfigureAwait(false);

                await _channelHandler.OnQueueDeclareOkAsync(header.Channel, declareOk).ConfigureAwait(false);

                break;
            }

            case 21:     //bind-ok
            {
                var bindOk = await protocol.ReadQueueBindOkAsync(token).ConfigureAwait(false);

                await _channelHandler.OnQueueBindOkAsync(header.Channel).ConfigureAwait(false);

                break;
            }

            case 51:     //unbind-ok
            {
                var unbindOk = await protocol.ReadQueueUnbindOkAsync(token).ConfigureAwait(false);

                await _channelHandler.OnQueueUnbindOkAsync(header.Channel).ConfigureAwait(false);

                break;
            }

            case 31:     //purge-ok
            {
                var purged = await protocol.ReadQueuePurgeOkAsync(token).ConfigureAwait(false);

                await _channelHandler.OnQueuePurgeOkAsync(header.Channel, purged).ConfigureAwait(false);

                break;
            }

            case 41:     //delete-ok
            {
                var deleted = await protocol.ReadQueueDeleteOkAsync(token).ConfigureAwait(false);;
                await _channelHandler.OnQueueDeleteOkAsync(header.Channel, deleted).ConfigureAwait(false);;
                break;
            }

            default:
                throw new RabbitMQMethodException(nameof(ProcessQueue), method.ClassId, method.MethodId);
            }
        }