1

I'm testing an application which accepts the compressed messages over IBM MQ. This requires me to send compressed (.zip) message on IBM MQ with custom jms property as Compressed = Y

I am struggling with 2 issues -

  1. How to load a .zip message in _IBMMQ
  2. Set the header or _jms property as Compressed = 'Y'

I've tried, via Python (1) pymqi- I was able to send a string over MQ. But unable to send a .zip till now.

(2) Spring Python - With this I was able to set the custom property as Compressed Y, but again stuck with loading the .zip into Queue.

#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.
JoshMc
  • 10,239
  • 2
  • 19
  • 38
Agam
  • 21
  • 3
  • Check out the source for https://www.capitalware.com/ufm_overview.html – JoshMc Mar 30 '19 at 18:06
  • Can you describe the problem you experience when putting a zip file as a message please? For example what return code do you suffer. – Morag Hughson Mar 30 '19 at 21:43
  • @MoragHughson: No error or exception. It's the thing that I am unable to insert the message on the queue other than when it's a string format. In case of string, I can read the full message into a single line and can insert it. but how to do that when it's a object or byte (line .zip). Like the below, message is a string queue.put(message) I've tried to give filename.zip in place of the message, it sent a string filename.zip in the queue – Agam Mar 31 '19 at 12:19
  • Agam, IBM MQ does not come with a out of the box way to send files by specifying a file name. There is a additional feature of MQ that comes with MQ Advanced called Manged File Transfer, but this is an additional cost above normal IBM MQ. You would need to read the the file and then sending as a MQFMT_NONE message so MQ conversion does not happen. Default MQ MAXMSGL is 4MB, if you ever need to send more than that you will need to take into account the max message length allowed or use auto segmentation (not supported in JMS). – JoshMc Apr 01 '19 at 05:59
  • My suggestion above to check out UFM, while not an answer, it does provide a opensource tool that does what you are asking to look at, maybe you decide to use it, or if you still want/need to write your own it may give you some ideas on how to handle things. – JoshMc Apr 01 '19 at 05:59
  • Thank you @MoragHughson for the above suggestions, I am able to do this via extended features of pymqi on python, will post a solution here.. – Agam Feb 27 '20 at 21:16
  • Thank you @JoshMc, for the above suggestions – Agam Feb 27 '20 at 21:18

0 Answers0