【发布时间】:2020-01-31 23:02:15
【问题描述】:
我正在编写一个新程序,并想连接到队列管理器。在python程序中如何配置?
【问题讨论】:
标签: python python-3.x ibm-mq pymqi
我正在编写一个新程序,并想连接到队列管理器。在python程序中如何配置?
【问题讨论】:
标签: python python-3.x ibm-mq pymqi
PyMQI 允许连接到队列管理器以发出 MQAI 和 PCF 请求。
以下代码建立连接,将消息放入队列并断开连接。
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()
【讨论】: