diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index f757efab64..894f68d097 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -90,29 +90,30 @@ namespace Volo.Abp.RabbitMQ lock (ChannelSendSyncLock) { - QueueBindCommands.TryPeek(out var command); - - switch (command.Type) + if (QueueBindCommands.TryPeek(out var command)) { - case QueueBindType.Bind: - Channel.QueueBind( - queue: Queue.QueueName, - exchange: Exchange.ExchangeName, - routingKey: command.RoutingKey - ); - break; - case QueueBindType.Unbind: - Channel.QueueUnbind( - queue: Queue.QueueName, - exchange: Exchange.ExchangeName, - routingKey: command.RoutingKey - ); - break; - default: - throw new AbpException($"Unknown {nameof(QueueBindType)}: {command.Type}"); + switch (command.Type) + { + case QueueBindType.Bind: + Channel.QueueBind( + queue: Queue.QueueName, + exchange: Exchange.ExchangeName, + routingKey: command.RoutingKey + ); + break; + case QueueBindType.Unbind: + Channel.QueueUnbind( + queue: Queue.QueueName, + exchange: Exchange.ExchangeName, + routingKey: command.RoutingKey + ); + break; + default: + throw new AbpException($"Unknown {nameof(QueueBindType)}: {command.Type}"); + } + + QueueBindCommands.TryDequeue(out command); } - - QueueBindCommands.TryDequeue(out command); } } }