I have the following environment:
- Redhat
- Python 2.7
I have a module which reads messages from an IBM MQ and then process them. The scenarios is as follows:
- Start the application
- Simulate connection is lost with the VM where the IBM MQ resides by issuing ifdown eth0 command
- As expected the connection is lost
Expected behavior:
- An pymqi.MQMIError being raised
Observed behavior:
- All the pymqi calls just get blocked. The running thread does nothing unless the connection is enabled again with ifup.
This is part of the code:
def connect_and_subscribe(self):
"""Connect to IBM MQ and subscribe"""
self.qmgr = pymqi.connect(self.qmgr_name, self.qmgr_channel, self.qmgr_connect)
self.queue = pymqi.Queue(self.qmgr, self.queue_name)
self.queue_i = pymqi.Queue(self.qmgr, self.queue_name)
self.queue_i_type = self.queue_i.inquire(pymqi.CMQC.MQIA_Q_TYPE)
self.connected = True
logging.info('CONNECTED TO MQ USING PYMQI VERSION <%s>' % (pymqi.__version__))
return
#--------------------------------------------------------------------
m = None
# Message Options
gmo = pymqi.GMO()
gmo.Options = pymqi.CMQC.MQGMO_WAIT | pymqi.CMQC.MQGMO_FAIL_IF_QUIESCING | pymqi.CMQC.MQPMO_SYNCPOINT
gmo.WaitInterval = self.max_cycle_wait_secs * 1000
while True:
try:
m = None
md = pymqi.MD()
m = self.queue.get(None, md, gmo)
self.queue.commit()
except pymqi.MQMIError as e:
if e.reason == pymqi.CMQC.MQRC_NO_MSG_AVAILABLE:
.....
Any ideas?