7 MSGSERVER=
'atlas-mb.cern.ch'
14 def __init__(self, listener, dest='/topic/atlas.dqm.progress',
21 if stomp.__version__ >= (6,1,0):
24 logging.critical(
"Unable to find stomp.py >= 6.1.0, can't proceed")
25 raise ValueError(
"Version of stomp.py is too old")
28 serverlist=[_[4]
for _
in socket.getaddrinfo(MSGSERVER, MSGPORT,
32 from .
import stompconfig
36 for svr
in serverlist:
37 auth = stompconfig.config()
39 cfg[
'heartbeats'] = (0,0)
40 cfg[
'reconnect_attempts_max'] = 3
41 conn=stomp.Connection([svr], **cfg)
42 conn.set_listener(
'somename',self.
listener)
45 conn.connect(wait=
True, **auth)
48 if hasattr(self.
listener,
'ack_mode'):
52 conn.subscribe(destination=self.
dest, ack=ack_mode, headers = hdr, id=len(self.
conns))
57 for conn
in self.
conns:
60 except Exception
as e:
61 print(
'Exception closing connections:' +
repr(e))