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 » JMS TextMessage and RFH2

Post new topic  Reply to topic
 JMS TextMessage and RFH2 « View previous topic :: View next topic » 
Author Message
Aktavian
PostPosted: Tue Mar 13, 2007 11:33 am    Post subject: JMS TextMessage and RFH2 Reply with quote

Newbie

Joined: 13 Mar 2007
Posts: 5

Hey all,

So I'm not very familar with working MQ's so please bear with me. I'm currently working on a project which uses MQ's to send messages between a Java applications and mainframe.

Here's kind of a crude diagram.

App 1 -> Q1 -> App2 -> Q2 -> App3

App1 and App2: Java, Websphere Application Server
App3: Mainframe
Q1 and Q2: Queues, Websphere MQ

So the quick breakdown is that App1 passes mesages to Q1, App 2 picks up messages from Q1, App 2 passes messages to Q2, etc.. until the message reaches App3.

The problem is that as the messages are passed, we're trying to maintain some information so that when a reply message is sent from App3 back to App1, it knows where to go. We wanted to accomplish this by putting return to queue names into the RFH2 header.

There's tons of information on the web about how this works, but not actually how to do it. From what I kind of get, if you set the JMS (MQMD?) header fields, Websphere MQ will automatically map those to an RFH2 header. Is that correct? And besides the default header fields in RFH2, how do you actually create an RFH2 header with your own fields and set those values?

I hope this wasn't too confusing and greatly any help I can get. Thanks.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 13, 2007 12:45 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Just set each step on the way...

You can set the destination to strip the RFH header... (so you don't have to deal with it on the MF).

Look into defining your queues as type MQ vs JMS and the following uri specification:
queue:///MYQUEUE?targetClient=1

Now the setting of the reply to queue:
Code:
TextMessage mymsg = mysession.createTextMessage("This is a test");
Queue myreplytoq = mysession.createQueue("queue:///MYREPLYTOQ?targetClient=1");
mymsg.setJMSReplyTo(myreplytoq);


Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Aktavian
PostPosted: Wed Mar 14, 2007 6:29 am    Post subject: Clarification Reply with quote

Newbie

Joined: 13 Mar 2007
Posts: 5

Thanks for the FJB, though I'm not quite if I understand. After talking with my teammate here's actually a better summarized list of questions that would be simpler to understand.

JMS TextMessage when created do not automatically contain a RFH2 I assume. If the queues are managed by Websphere MQ, does it create a RFH2 header when it receives the JMS TextMessage and map the appropriate JMS fields to the RFH2 fields?

And if not, how do I go about creating my own RFH2 header? What methods of the API do I use as I can't seem to find any that would be useful or do I need to right my own customized class to create an RFH2 header?

From some of the code I've found on the net (mostly C it seems), it writes the headers in a byte stream. Does that mean I'll have to do the same? And do I just append it at the beginning of the content of the TextMessage?

Whoever's reading this, thanks for taking the time to help.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 14, 2007 1:13 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

JMS TextMessages do not contain an MQRFH2 ever.

The MQ JMS Provider creates an MQRFH2 when the Provider writes an MQJMSMessage object to a queue, unless the Target Client property of the JMS Destination has been set to indicate that the MQRFH2 should not be created.

The MQ JMS Provider will also parse an MQRFH2 header, if present, when it reads an MQ message and creates an MQJMSMessage object.

There is no way in JMS to manipulate an MQRFH2 header, as JMS has no knowledge of the MQRFH2 header.

There is no way to use the MQ JMS Provider to manipulate the MQRFH2 header, other than through JMS and how the documentation says that the JMS Message is mapped to the MQ Message.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 14, 2007 2:03 pm    Post subject: Re: Clarification Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Aktavian wrote:

JMS TextMessage when created do not automatically contain a RFH2 I assume. If the queues are managed by Websphere MQ, does it create a RFH2 header when it receives the JMS TextMessage and map the appropriate JMS fields to the RFH2 fields?
Like Jeff said the RFH2 is transparent to JMS. The mapping is described in the documentation.
You determine whether or not the message will have an RFH2 header when you define the Destination and more specifically set the targetClient. By default in JMS the targetClient is JMS and an RFH2 is created by the IBM JMS Provider. You don't have to do anything. If you want to suppress it just set the targetClient property to "MQ" in jndi or "=1" on the destination URI.

Aktavian wrote:
And if not, how do I go about creating my own RFH2 header? What methods of the API do I use as I can't seem to find any that would be useful or do I need to right my own customized class to create an RFH2 header?
You don't!. You let JMS take care of it for you. The content of the usr folder is being set by the properties (custom properties) you set on the message.

Aktavian wrote:
From some of the code I've found on the net (mostly C it seems), it writes the headers in a byte stream. Does that mean I'll have to do the same? And do I just append it at the beginning of the content of the TextMessage?
No if you have to use a non java language to deal with RFH headers my first choice would be to check if the XMS support pack is a viable solution...
Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Aktavian
PostPosted: Thu Mar 15, 2007 8:56 am    Post subject: Thanks Reply with quote

Newbie

Joined: 13 Mar 2007
Posts: 5

Thanks FJB and Jeff for the help. The explanations you gave were you really helpful in understanding JMS and RFH2.

Though there is still one thing that would be helpful if you could clarify. FJB mentioned that I can set my targetClient.

Any message sent to the queue using the default targetClient setting will automaticaly use the JMSTextMessage attribute values to create the RFH2 header? (and will the JMS header precede the RFH2 header? I remember seeing it in some IBM documentation diagram that I was looking at, unless I'm mistaken.)

And if it the targetClient is set to 1, then all it does is exclude the RFH2 header?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Mar 15, 2007 7:55 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

The JMS header IS the RFH header (The attributes go into the "usr" folder). See RFHUtil tool support pack IH03 ?
Yes setting the targetClient property to 1 in the URI will suppress the RFH header...
_________________
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 » JMS TextMessage and RFH2
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.