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)
{
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);
}
}
}

Loading…
Cancel
Save