1

I'm write a new program, and want to connect to queue manager. how do I configure in python program?

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Kevin.Wu
  • 13
  • 2

1 Answers1

1

PyMQI allows one to connect to queue managers to issue MQAI and PCF requests.

Below code establishes a connection, puts a message on a queue and disconnects.

import pymqi

    queue_manager = 'QM01'
    channel = 'SVRCONN.1'
    host = 'host.domain.com'
    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 details: https://github.com/dsuch/pymqi

Mebin Joe
  • 2,172
  • 4
  • 16
  • 22