From 6ba8a1a6b2fe0f1f5027e6b06394fac522fd9cfb Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 31 Jul 2023 17:49:43 +0800 Subject: [PATCH] Use one-off channels for passive declarations --- .../Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index 8d4756165a..d08d42fd0c 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -330,7 +330,10 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe try { - channel.ExchangeDeclarePassive(AbpRabbitMqEventBusOptions.ExchangeName); + using (var temporaryChannel = ConnectionPool.Get(AbpRabbitMqEventBusOptions.ConnectionName).CreateModel()) + { + temporaryChannel.ExchangeDeclarePassive(AbpRabbitMqEventBusOptions.ExchangeName); + } } catch (Exception) {