pythonibm-mqpymqi

Unable to connect to IBM MQ using pymqi


I am getting the below error while connecting to IBM MQ using library pymqi.

Its a clustered MQ channel

pymqi.MQMIError: MQI Error. Comp: 2, Reason 2539: FAILED: MQRC_CHANNEL_CONFIG_ERROR

Please see my code below.

queue_manager = "QMNAME"
channel = bytes(str("CHANNEL_NAME"))
host = "xx.xx.xx.xx"
port = "1800"
queue_name = "QN"
conn_info1 = bytes("%s(%s)" % (host, port))
message = b'{"alert":[{"timestamp":"Wed Jun 27 11:07:37 CDT 2018","shortDescription":"Last 24 hrs Sev 4 Volume Deviation is 84% lower than baseline","alertColor":"red","title":"Sev 4 Volume Deviation"}]}'

# Message Descriptor
put_mqmd = pymqi.MD()
qmgr = pymqi.connect(queue_manager, channel, conn_info1)
queue = pymqi.Queue(qmgr, queue_name)

Getting error at the line below

qmgr = pymqi.connect(queue_manager, channel, conn_info1)

Solution

  • Cause:

    The 2539 (MQRC_CHANNEL_CONFIG_ERROR) error is a result of you attempting to connect to a channel on the queue manager that is not of type SVRCONN. A MQ client must connect to a SVRCONN channel.

    Additional information:

    If you review the queue manager error logs you would see corresponding AMQ9502 errors, for example:

    AMQ9502: Type of channel not suitable for action requested.
    
    EXPLANATION:
    The operation requested cannot be performed on channel 'CHANNEL_NAME'. Some
    operations are only valid for certain channel types. This channel is a
    'CLUSRCVR' channel type. For example, you can only ping or trigger a channel
    from the initiating end.
    ACTION:
    Check whether the channel name is specified correctly.  If it is check that the
    channel has been defined correctly.
    

    Resolution:

    Make sure you have a SVRCONN channel defined on the queue manager you wish to connect to.

    Troubleshooting:

    The MQ client comes with a sample program amqscnxc, you could use this to test out the parameters you have specified in your example. For instance on Linux/Unix (quoting of the conname may be different on Windows) do the following:

    amqscnxc -x 'xx.xx.xx.xx(1800)' -c CHANNEL_NAME QMNAME
    

    The result would be the same 2539 error, but this does show it is not a pymqi specific problem.