Browse Source

Should check the result of QueueBindCommands.TryPeek.

pull/7796/head
Halil İbrahim Kalkan 6 years ago
parent
commit
7fcb5121ae
  1. 43
      framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs

43
framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs

@ -90,29 +90,30 @@ namespace Volo.Abp.RabbitMQ
lock (ChannelSendSyncLock) lock (ChannelSendSyncLock)
{ {
QueueBindCommands.TryPeek(out var command); if (QueueBindCommands.TryPeek(out var command))
switch (command.Type)
{ {
case QueueBindType.Bind: switch (command.Type)
Channel.QueueBind( {
queue: Queue.QueueName, case QueueBindType.Bind:
exchange: Exchange.ExchangeName, Channel.QueueBind(
routingKey: command.RoutingKey queue: Queue.QueueName,
); exchange: Exchange.ExchangeName,
break; routingKey: command.RoutingKey
case QueueBindType.Unbind: );
Channel.QueueUnbind( break;
queue: Queue.QueueName, case QueueBindType.Unbind:
exchange: Exchange.ExchangeName, Channel.QueueUnbind(
routingKey: command.RoutingKey queue: Queue.QueueName,
); exchange: Exchange.ExchangeName,
break; routingKey: command.RoutingKey
default: );
throw new AbpException($"Unknown {nameof(QueueBindType)}: {command.Type}"); break;
default:
throw new AbpException($"Unknown {nameof(QueueBindType)}: {command.Type}");
}
QueueBindCommands.TryDequeue(out command);
} }
QueueBindCommands.TryDequeue(out command);
} }
} }
} }

Loading…
Cancel
Save