|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
setting MQRFH2 Header in Java |
« View previous topic :: View next topic » |
Author |
Message
|
patb23 |
Posted: Wed Oct 25, 2006 7:29 am Post subject: setting MQRFH2 Header in Java |
|
|
Newbie
Joined: 25 Oct 2006 Posts: 4
|
Hi,
I Want to set MQRFH2 header for outbound message.
I am trying to set JMS header (equivalent to setStringProperty of JMS API). Based on the examples, found in this forum, I am setting the header like shown below. I notioce that when we receivbe the Message, the property appears to be appended to the message instead of appearing as an Header.
Could anyone let me know, where am I making a mistake?
PS: I am new to MQ Sereis.
ostream.writeChars(MQC.MQRFH_STRUC_ID);//StrucID
ostream.writeInt(MQC.MQRFH_VERSION_2);//Version
ostream.writeInt(strucLength+ headerContent.length() );//StrucLength
ostream.writeInt(MQC.MQENC_NATIVE);//Encoding
ostream.writeInt(MQC.MQCCSI_DEFAULT);//CodedCharSetID
ostream.writeChars(MQC.MQFMT_STRING);//Format
ostream.writeInt(MQC.MQRFH_NO_FLAGS);//Flags
ostream.writeInt(1208);//NameValueCCSID
ostream.writeInt(headerContent.toString().getBytes().length);//NameValueLength
ostream.writeChars(headerContent.toString() ); //NameValueData
ostream.flush();
rfh2Header = bstream.toByteArray();
message.write(rfh2Header) |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 25, 2006 7:31 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
My Java's weak but check out the Java manual. The MQRFH2 is mapped to/from a JMS header automatically by the MQ Java classes. You actually have to set a parameter (TARGCLIENT?) to stop an RFH2 being added. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 25, 2006 7:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
MQ headers work like this. The MQMD is always there, and always distinct from the rest of the headers. Everything else is in the Body of the message (the buffer). The Format field of the MQMD indicates if the Body starts with a Header or not - in your case the Format field of the MQMD should indicate an MQRFH2. Then the format of each Header indicates the contents of the NEXT section. So if you only have an MQRFH2, then the Format field of the MQRFH2 should be MQFMT_STRING or whatever.
Each section (header or message data) in the Body is separated from the next section by a blank line. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 25, 2006 1:07 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Are you trying to handle a JMS header in java base?
Don't do that. Switch to JMS.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|