From bec28ca3897cb9846c0d87184885169fd4f31e39 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 24 Jul 2019 11:02:11 +0800 Subject: [PATCH] Fixed connection dispose bug before connection connected. --- src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs | 2 +- src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs b/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs index 5753654..2a38cbf 100644 --- a/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs +++ b/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs @@ -75,7 +75,7 @@ namespace DotNetCore.CAP.Kafka public void Dispose() { - _consumerClient.Dispose(); + _consumerClient?.Dispose(); } #region private methods diff --git a/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs b/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs index 953ee06..430ac20 100644 --- a/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs +++ b/src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs @@ -89,8 +89,8 @@ namespace DotNetCore.CAP.RabbitMQ public void Dispose() { - _channel.Dispose(); - _connection.Dispose(); + _channel?.Dispose(); + _connection?.Dispose(); } #region events