我正在编写一个新程序,并想连接到队列管理器。如何在python程序中配置?
问问题
167 次
1 回答
1
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()
于 2019-04-01T07:43:04.507 回答