Skip to content

Commit

Permalink
fix (StompMQConnector): adapt to stomp 8
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed May 16, 2022
1 parent 7ff48a8 commit 2c5afcc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/DIRAC/Resources/MessageQueue/StompMQConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand All @@ -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))
Expand Down

0 comments on commit 2c5afcc

Please sign in to comment.