How to have pymqi use compression

Asked by Brent S Elmer

Is there a setting or something to have MQ compress the messages. I don't have admin access to do any system level changes. I just thought there might be a setting that can be used in the pymqi calls to request compression.

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
No assignee Edit question
Solved by:
Dariusz Suchojad
Solved:
Last query:
Last reply:
Revision history for this message
Best Dariusz Suchojad (dsuch) said :
#1

Here's the code but the requested compression technique will be silently ignored by the queue manager unless the channel have been configured properly, a simple MQSC ALTER will do the trick, e.g.

ALTER CHANNEL(SVRCONN.1) CHLTYPE(SVRCONN) COMPMSG(ZLIBHIGH)

The compression ratio is quite okay so you may consider asking the admins for altering the channel's definition.

import pymqi
import CMQXC

queue_manager = "QM01"
channel = "SVRCONN.1"
host = "192.168.1.141"
port = "1434"
queue_name = "TEST.1"
message = "Hello from Python!" * 10000
conn_info = "%s(%s)" % (host, port)

cd = pymqi.cd()
cd.MsgCompList[1] = CMQXC.MQCOMPRESS_ZLIBHIGH

qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(queue_manager, cd, channel, conn_info)

queue = pymqi.Queue(qmgr, queue_name)
queue.put(message)
queue.close()

qmgr.disconnect()

I'll add the code to the list of examples at http://packages.python.org/pymqi/examples.html

Revision history for this message
Brent S Elmer (webe3vt) said :
#2

Thanks Dariusz Suchojad, that solved my question.