我正在测试一个通过 IBM MQ 接受压缩消息的应用程序。这需要我在 IBM MQ 上发送压缩 (.zip) 消息,自定义 jms 属性为 Compressed = Y
我正在努力解决两个问题 -
- 如何在 _IBMMQ 中加载 .zip 消息
- 将标头或 _jms 属性设置为 Compressed = 'Y'
我已经尝试过,通过 Python (1) pymqi-我能够通过 MQ 发送一个字符串。但直到现在无法发送 .zip。
(2) Spring Python - 有了这个,我能够将自定义属性设置为 Compressed Y,但再次将 .zip 加载到队列中。
#PYMQI
import pymqi
queue_manager = 'QM1'
channel = 'DEV.APP.SVRCONN'
host = '127.0.0.1'
port = '1414'
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()
# Spring Python
from springpython.jms.core import TextMessage
msg = TextMessage("Hello!")
msg.Compressed = "Y"
print msg
from springpython.jms.core import JmsTemplate
from springpython.jms.factory import WebSphereMQConnectionFactory
qm_name = "QM.1"
channel = "SVRCONN1.1"
host = "192.168.1.121"
listener_port = "1434"
queue1 = "TEST.1"
factory = WebSphereMQConnectionFactory(qm_name, channel, host,
listener_port)
jms_template = JmsTemplate(factory)
jms_template.send(msg, queue1)
factory.destroy()
#Above code is for reference only, I have taken them from their own websites.