Skip to content

Commit 7db8cb2

Browse files
authored
Merge pull request #24 from BNLNPPS/maxim-refactor
Adjusted MQ subscription to ensure durable delivery
2 parents 90deec9 + 3fe6f74 commit 7db8cb2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

mq_comms/mq_comms.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
mq_host = os.environ.get('MQ_HOST', 'pandaserver02.sdcc.bnl.gov')
1515
mq_cafile = os.environ.get('MQ_CAFILE', '')
16+
17+
mq_subscription_name = os.environ.get('MQ_SUBSCRIPTION_NAME', 'epic_streaming_testbed')
1618
###################################################################
1719
class Messenger:
1820
"""
@@ -130,6 +132,8 @@ def __init__(self, host=mq_host, port=mq_port, username=mq_user, password=mq_pas
130132
super().__init__(host=mq_host, port=mq_port, username=mq_user, password=mq_passwd, client_id=client_id, verbose=verbose)
131133
self.processor = processor
132134
# self.client_id = client_id - should be done in the base.
135+
if self.verbose:
136+
print(f"Initializing Receiver with host={self.host}, port={self.port}, username={self.username}, client_id={self.client_id}")
133137

134138
# ---
135139
def connect(self):
@@ -153,6 +157,9 @@ def connect(self):
153157
destination='epictopic',
154158
id=1,
155159
ack='auto',
156-
headers={'activemq.subscriptionName': self.client_id}
160+
headers={
161+
'activemq.subscriptionName': mq_subscription_name,
162+
'client-id': self.client_id
163+
}
157164
)
158165

0 commit comments

Comments
 (0)