Processing MQ ByteMessage using JMS client

落花浮王杯 提交于 2019-12-25 01:56:10

问题


I am using IBM MQ and Java to write a message as Bytes on to the queue. Problem here i am getting here is while reading this message from JMS client offcourse that is expected format,i am getting as "BytesMessage" instead of message in MQSTR format.

What properties i have to set while writing the message on to the queue ,so JMS client consume that message as Text instead of Byte?

Do i need to chnage any of the below properties or anything else?

openOptions =MQC.MQOO_OUTPUT
putOptions=MQC.MQPMO_SYNCPOINT

Below is the sample producer code,Here i am not mentioning entire code.

String message="text";  
final MQMessage mqm = new MQMessage();
mqm.write(message.getBytes());

Regards,

Chaitu


回答1:


Well, if your message is going to be of text format only, then what's the point of writing as Bytes.

Instead, you can use other functions like:

String message="text";  
MQMessage mqm = new MQMessage();
mqm.writeString(message);

Also, you can set the "format" property of your message to any valid format(MQRFH2, MQSTR etc) like:

mqm.format="MQSTR";


来源:https://stackoverflow.com/questions/18958466/processing-mq-bytemessage-using-jms-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!