PyMQI allows one to connect to queue managers to issue MQAI and PCF requests.
Consider the code below which establishes a connection, puts a message on a queue and disconnects.
import pymqi
queue_manager = 'QM01'
channel = 'SVRCONN.1'
host = '192.168.1.135'
port = '1434'
queue_name = 'TEST.1'
message = 'Hello from Python!'
conn_info = '%s(%s)' % (host, port)
qmgr = pymqi.connect(queue_manager, channel, conn_info)
queue = pymqi.Queue(qmgr, queue_name)
queue.put(message)
queue.close()
qmgr.disconnect()
More usage examples can be found here https://pythonhosted.org/pymqi/examples.html
There are some tests fail to pass, while some tests may not be applicable to python3, there might be bugs caused by this porting. I'll look into those latter. Patches for welcome.
According to PyMQI, any MQ version between 5.0 and 7.5 should work. Note this port will only work will Python 3.x.
Please visit the main documentation at https://pythonhosted.org/pymqi/index.html for more information.