From e4c3135e11a20f949f52745e912a469e3986e9cd Mon Sep 17 00:00:00 2001 From: eduard93 Date: Sat, 14 Mar 2020 23:22:17 +0300 Subject: [PATCH] On initializing RabbitMQ connection close old connection if available. --- isc/rabbitmq/Common.cls | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/isc/rabbitmq/Common.cls b/isc/rabbitmq/Common.cls index 00ae484..03f4895 100644 --- a/isc/rabbitmq/Common.cls +++ b/isc/rabbitmq/Common.cls @@ -90,6 +90,11 @@ Method ConnectToRabbitMQ() As %Status } Try { + If $IsObject(..API) { + Do ..API.close() + Set ..API = $$$NULLOREF + } + Set ..API = ##class(isc.rabbitmq.API).%New(..JGW, ..Host, ..Port, user, pass, ..VirtualHost, ..Queue, $$$YES, ..Exchange) } Catch ex { Set sc = ..ExceptionToStatus(ex)