How to connect to local MQseries queue using Python?
- by Michal Niklas
I am new to mqseries and I started with IBM WebSphere MQ curses. There are examples with MQ_APPLE and MQ_ORANGE queue managers. I have no problem with sending messages to local or remote queue with MQ Explorer, but I wanted to send such message from code: Python or Java. I tried Python pymqi library with code like this:
import pymqi
qmgr = pymqi.QueueManager(None)
qmgr.connect('QM_APPLE')
putq = pymqi.Queue(qmgr, 'Q1')
putq.put('Hello from Python!')
but I receive error:
Traceback (most recent call last):
File "mq_put.py", line 4, in <module>
qmgr.connect('QM_APPLE')
File "c:\Python26\lib\site-packages\pymqi.py", line 758, in connect
raise MQMIError(rv[1], rv[2])
pymqi.MQMIError: MQI Error. Comp: 2, Reason 2540: FAILED: MQRC_UNKNOWN_CHANNEL_NAME
There is QM_APPLE queue manager with Q1 local queue.
What is wrong with my code?