From 2c5afccccf8b04d7e02aff6dc8f9fa8a0614f70f Mon Sep 17 00:00:00 2001 From: Christophe Haen Date: Mon, 16 May 2022 13:49:12 +0200 Subject: [PATCH] fix (StompMQConnector): adapt to stomp 8 --- .../Resources/MessageQueue/StompMQConnector.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/DIRAC/Resources/MessageQueue/StompMQConnector.py b/src/DIRAC/Resources/MessageQueue/StompMQConnector.py index b55f42e4166..5ca2f912929 100644 --- a/src/DIRAC/Resources/MessageQueue/StompMQConnector.py +++ b/src/DIRAC/Resources/MessageQueue/StompMQConnector.py @@ -89,6 +89,7 @@ def setupConnection(self, parameters=None): "reconnect_sleep_jitter": reconnectSleepJitter, "reconnect_attempts_max": reconnectAttemptsMax, } + sslArgs = None # We use ssl credentials and not user-password. if sslVersion is not None: @@ -101,9 +102,13 @@ def setupConnection(self, parameters=None): return S_ERROR("Could not find a certificate!") hostcert = paths[0] hostkey = paths[1] - connectionArgs.update( - {"use_ssl": True, "ssl_version": sslVersion, "ssl_key_file": hostkey, "ssl_cert_file": hostcert} - ) + sslArgs = { + "use_ssl": True, + "ssl_version": sslVersion, + "ssl_key_file": hostkey, + "ssl_cert_file": hostcert, + } + else: return S_ERROR(EMQCONN, "Invalid SSL version provided: %s" % sslVersion) @@ -125,6 +130,8 @@ def setupConnection(self, parameters=None): connectionArgs.update({"host_and_ports": host_and_ports}) log.debug("Connection args: %s" % str(connectionArgs)) self.connection = stomp.Connection(**connectionArgs) + if sslArgs: + self.connection.set_ssl(**sslArgs) except Exception as e: log.debug("Failed setting up connection", repr(e))