How to connect to local MQseries queue using Python?

Posted by Michal Niklas on Stack Overflow See other posts from Stack Overflow or by Michal Niklas
Published on 2010-03-29T08:56:40Z Indexed on 2010/03/29 13:43 UTC
Read the original article Hit count: 544

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about mqseries

Related posts about websphere-mq