Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IBM MQ PUT Message Format: MQSTR issue

Status
Not open for further replies.

gauravrajbehl

Programmer
Feb 11, 2020
1
AU
Hi Folks,

I am trying to put message to MQ using Java, however, the message is going as MQHRF2 instead of MQSTR. I have been trying to resolve this from last 2 weeks but I am unable to. Need your help to kindly advise how I can get the MQSTR format. I am setting the message format as MQSTR, however it is getting overwritten. Below is the sample code I am using:

[pre]Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("channel", "CLIENTS.ICARGO");
props.put("port", 1414);
props.put("hostname", "ei-s-mq.qantas.com.au");

String qManager = "QMS126";
String queueName = "IC.EI.XMAMS.AMADEUS.INOUT";
MQQueueManager qMgr = null;


try {

qMgr = new MQQueueManager(qManager, props);
int openOptions = MQConstants.MQOO_OUTPUT | CMQC.MQOO_SET_ALL_CONTEXT ;

MQQueue queue = qMgr.accessQueue(queueName, openOptions);


MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = CMQC.MQPMO_SET_ALL_CONTEXT;

MQMessage message = new MQMessage();
message.setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true);
message.setIntProperty(WMQConstants.WMQ_MQMD_MESSAGE_CONTEXT, WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
message.format = MQConstants.MQFMT_STRING;
message.putApplicationName = "Tracking";
message.applicationOriginData = "DATA";
message.applicationIdData = "1ATYPBEIP";
message.userId = "eiptypb";
message.replyToQueueName = "IC.AMADEUS.ICARGOAMS.EI.INOUT.ERROR";
message.replyToQueueManagerName = "QMS126";
message.messageType = 8;
message.persistence = 1;


message.writeString("0D 0A 01 QD MELHOJQ 0D 0A . .SYDFRQF 054238 0D 0A 02 QF0001/30.SYD.FINAL -AKE1111111/MEL/1A/C BULK -MEL/1A/C SI LOADING PRIORITY AS FOLLOWS 1 - AKE1111111 1 - BULKMEL/1A/C 0D 0A 03");
queue.put(message, pmo);
queue.close();
[/pre]

Thanks for your time and help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top