Message Descriptor overwritten

Asked by Arvis Skujenieks

Hi !

I came across the situation when fields in message descriptor gets overwritten or blanked
I have noticed it when trying to get messge from the que I have put it

I would appreciate if someone could guide me in right direction as I would assume that I am doing
something wrong since I am preatty new to the pyMQI and IBM MQ in general

here is code
import pymqi

mq_port = '1414'
mq_host = '10.2.6.41'
mq_manager = 'lido.queue.manager'
mq_channel = 'SYSTEM.DEF.SVRCONN'
mq_queue = 'TEST1'

message = 'Test message'

#message desriptor
md = pymqi.md()
md.MsgType = 8
md.Persistence = 0
md.Format = 'MQSTR '
md.ApplOriginData = 'IEDI'
md.ReplyToQ = 'lido.queue.manager.test'
md.ReplyToQMgr = 'GWT11.BT1'
md.UserIdentifier = 'FBTNGDMQ1A'
md.ApplIdentityData = '1ASICOBT'

# connecting
conn_info = "%s(%s)" % (mq_host, mq_port)
qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(mq_manager, pymqi.cd(), mq_channel, conn_info)
queue = pymqi.Queue(qmgr,mq_queue)

queue.put(message,md)

queue.close()
qmgr.disconnect()

here is some fields before put()
  UserIdentifier: FBTNGDMQ1A
  ApplIdentityData: 1ASICOBT
  ApplOriginData: IEDI

here is how they look after get() the same message from queue
UserIdentifier: mqm
ApplIdentityData:
ApplOriginData:

Thanks in advace

Arvis

Question information

Language:
English Edit question
Status:
Solved
For:
PyMQI Edit question
Assignee:
No assignee Edit question
Solved by:
Arvis Skujenieks
Solved:
Last query:
Last reply:
Revision history for this message
Arvis Skujenieks (arvisbt) said :
#1

HI!

Reading of the documentation is required
Just need to pass message options along the message

now I will play with options settings to get what is required
Arvis

Revision history for this message
Dariusz Suchojad (dsuch) said :
#2

Hi Arvis,

I'm glad you got it working now. Yes, all I can say is that you need to use appropriate put message options, such as below - it's an almost ready to use example, you only need to fill in the rest of an MQMD header.

import CMQC
import pymqi

mq_port = '1418'
mq_host = '192.168.1.156'
mq_manager = 'QM01'
mq_channel = 'SVRCONN.1'
mq_queue = 'TEST.1'

message = 'Test message'

md = pymqi.md()

md.ReplyToQ = 'lido.queue.manager.test'
md.ReplyToQMgr = 'GWT11.BT1'

md.UserIdentifier = 'FBTNGDMQ1A'
md.ApplIdentityData = '1ASICOBT'
md.ApplOriginData = 'IEDI'

# Note that we use MQPMO_SET_ALL_CONTEXT so the rest of MQMD options needs
# to be filled in here as well.
#
# http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/js01146.htm

conn_info = "%s(%s)" % (mq_host, mq_port)
qmgr = pymqi.QueueManager(None)
qmgr.connectTCPClient(mq_manager, pymqi.cd(), mq_channel, conn_info)

od = pymqi.od()
od.ObjectName = mq_queue

queue = pymqi.Queue(qmgr)
queue.open(od, CMQC.MQOO_OUTPUT | CMQC.MQOO_SET_ALL_CONTEXT)

pmo = pymqi.pmo()
pmo.Options = CMQC.MQPMO_SET_ALL_CONTEXT

queue.put(message, md, pmo)
queue.close()

qmgr.disconnect()