示例#1
0
        public async ValueTask ProcessMethod()
        {
            var method = await ReadMethodHeader().ConfigureAwait(false);

            //Debug.WriteLine($"{method.ClassId} {method.MethodId}");
            switch (method.ClassId)
            {
            case 20:    //Channels class
            {
                await HandleMethodAsync(method).ConfigureAwait(false);

                break;
            }

            case 40:    //Exchange class
            {
                await _exchangeMethodHandler.HandleMethodAsync(method).ConfigureAwait(false);

                break;
            }

            case 50:    //queue class
            {
                await _queueMethodHandler.HandleMethodAsync(method).ConfigureAwait(false);

                break;
            }

            case 60:    //basic class
            {
                await _basicHandler.HandleMethodHeader(method).ConfigureAwait(false);

                break;
            }

            default: throw new Exception($"{nameof(RabbitMQDefaultChannel)}.HandleAsync :cannot read frame (class-id,method-id):({method.ClassId},{method.MethodId})");
            }
        }