From d17f4f3a9fd077fdcf25508567ff17b99e3c5fd7 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 8 Aug 2019 11:56:10 +0200 Subject: [PATCH] Fixed Tapeti not reconnecting after a disconnect event unless Publish is called --- Tapeti/Connection/TapetiWorker.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tapeti/Connection/TapetiWorker.cs b/Tapeti/Connection/TapetiWorker.cs index 2993535..aca3a3b 100644 --- a/Tapeti/Connection/TapetiWorker.cs +++ b/Tapeti/Connection/TapetiWorker.cs @@ -34,6 +34,7 @@ namespace Tapeti.Connection // These fields are for use in the taskQueue only! private RabbitMQ.Client.IConnection connection; + private bool isClosing; private bool isReconnect; private IModel channelInstance; private ulong lastDeliveryTag; @@ -173,6 +174,8 @@ namespace Tapeti.Connection return taskQueue.Value.Add(() => { + isClosing = true; + if (channelInstance != null) { channelInstance.Dispose(); @@ -371,6 +374,9 @@ namespace Tapeti.Connection }); channelInstance = null; + + if (!isClosing) + taskQueue.Value.Add(() => WithRetryableChannel(channel => { })); }; channelInstance.BasicReturn += HandleBasicReturn;