ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » setting MQRFH2 Header in Java

Post new topic  Reply to topic
 setting MQRFH2 Header in Java « View previous topic :: View next topic » 
Author Message
patb23
PostPosted: Wed Oct 25, 2006 7:29 am    Post subject: setting MQRFH2 Header in Java Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Wed Oct 25, 2006 7:31 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Wed Oct 25, 2006 7:37 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 25, 2006 1:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » setting MQRFH2 Header in Java
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.