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 » How to move messageID to reply message's correlation ID

Post new topic  Reply to topic
 How to move messageID to reply message's correlation ID « View previous topic :: View next topic » 
Author Message
erk
PostPosted: Fri Feb 09, 2007 9:59 am    Post subject: How to move messageID to reply message's correlation ID Reply with quote

Newbie

Joined: 09 Feb 2007
Posts: 2

Hello - I have read a number of discussions here about charset conversions between ASCII and EBCDIC, and CCSID and other ways of controlling the conversions. None of those seem to address our issue exactly.

We have an EJB running under WebSpher 5.1.1.11 that listens on an MQ queue and receives mainframe-originated MQ messages. The EJB does work and sends a reply back on the reply-to queue specified in the original message. There's never a problem with the body of the message - it comes over fine, and the reply goes back fine. The problems we have are strictly in the headers.

1. We want to use the original message's JMSMessageID as the reply message's JMSCorrelationID. However, the JMS Message API doesn't offer getJMSMessageIDAsBytes, nor does it offer getByteArrayProperty(), so it seems you HAVE to get the message ID as a String. That implies that you have to know the encoding, which is cp500 / EBCDIC, or you can't populate your String properly to later call setJMSCorrelationIDAsBytes on the reply message before you send it.

Am I way off? I've tried various ways of moving the original message's JMS message ID to the reply's JMSCorrelationID, but the conversion is always bad unless I explicitly convert to and from a String using charset cp500.

2. We also have an issue with targetClient. We were originally getting the reply queue from the original message's replyTo, and sending on that. The problem is that we were inadvertantly sending RFH2 headers our mainframe couldn't handle.

We tried to get them to send ?targetClient=1 in the replyTo queue property, but that ended up not parsing properly in JMS - it was treated as part of the queue name, and failed completely. So now we create a new queue, using the replyTo queue's name property, and appending ?targetClient=1.

Is there an easier way on both of these? We're trying to use very generic JMS code, but the above have forced us to do things that I thought should be configured in the queues. I just don't know enough about the queues to tell the MQ administrators if they've got something set up wrong.

Thanks for anything you can tell me!

- Eric
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Feb 09, 2007 10:12 am    Post subject: Re: How to move messageID to reply message's correlation ID Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi erk,
erk wrote:
1. We want to use the original message's JMSMessageID as the reply message's JMSCorrelationID. However, the JMS Message API doesn't offer getJMSMessageIDAsBytes, nor does it offer getByteArrayProperty(), so it seems you HAVE to get the message ID as a String. That implies that you have to know the encoding, which is cp500 / EBCDIC, or you can't populate your String properly to later call setJMSCorrelationIDAsBytes on the reply message before you send it.

Am I way off? I've tried various ways of moving the original message's JMS message ID to the reply's JMSCorrelationID, but the conversion is always bad unless I explicitly convert to and from a String using charset cp500.
The id's(msgId and correlId) for a jms message are string, then why do you require the conversion ? You would need to convert, if you were using jms at one end and mq on the other....or am I missing something ?

erk wrote:
2. We also have an issue with targetClient. We were originally getting the reply queue from the original message's replyTo, and sending on that. The problem is that we were inadvertantly sending RFH2 headers our mainframe couldn't handle.

We tried to get them to send ?targetClient=1 in the replyTo queue property, but that ended up not parsing properly in JMS - it was treated as part of the queue name, and failed completely. So now we create a new queue, using the replyTo queue's name property, and appending ?targetClient=1.
I did not get your requirement completely on this one, can you explain your flow in a little more detail...mentioning where you have jms, replyToQ etc.

Regards.
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Fri Feb 09, 2007 10:17 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://www-304.ibm.com/jct09002c/isv/tech/sample_code/mq/mqjmssrv.java


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Feb 10, 2007 7:26 pm    Post subject: Re: How to move messageID to reply message's correlation ID Reply with quote

Grand High Poobah

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

erk wrote:
Hello - I have read a number of discussions here about charset conversions between ASCII and EBCDIC, and CCSID and other ways of controlling the conversions. None of those seem to address our issue exactly.

We have an EJB running under WebSpher 5.1.1.11 that listens on an MQ queue and receives mainframe-originated MQ messages. The EJB does work and sends a reply back on the reply-to queue specified in the original message. There's never a problem with the body of the message - it comes over fine, and the reply goes back fine. The problems we have are strictly in the headers.

1. We want to use the original message's JMSMessageID as the reply message's JMSCorrelationID. However, the JMS Message API doesn't offer getJMSMessageIDAsBytes, nor does it offer getByteArrayProperty(), so it seems you HAVE to get the message ID as a String. That implies that you have to know the encoding, which is cp500 / EBCDIC, or you can't populate your String properly to later call setJMSCorrelationIDAsBytes on the reply message before you send it.

Am I way off? I've tried various ways of moving the original message's JMS message ID to the reply's JMSCorrelationID, but the conversion is always bad unless I explicitly convert to and from a String using charset cp500.


Yes you are way off. The JMSMessageId should be a string representation of a byte array in form of ID:00-FF i.e. a hex representation of the byte array. So all you have to do is

outmsg.setCorrelId(inmsg.getMessageId());

The pattern is one of anonymous identifier. And don't worry about translating ever... a byte is still a byte which ever the system...

erk wrote:
2. We also have an issue with targetClient. We were originally getting the reply queue from the original message's replyTo, and sending on that. The problem is that we were inadvertantly sending RFH2 headers our mainframe couldn't handle.

We tried to get them to send ?targetClient=1 in the replyTo queue property, but that ended up not parsing properly in JMS - it was treated as part of the queue name, and failed completely. So now we create a new queue, using the replyTo queue's name property, and appending ?targetClient=1.

Depending on your version you are doing the right thing...
Check out defining the queues with uri myqname="queue://destqmgr/destq?prop=value&prop2=value2";
session.createQueue(myqname);

However if you move to version 6 of MQ you have an additional property on the QCF. By default qcf.setTargetClientMatching(true);

This should ensure that the reply message gets an RFH only if the request message had one....

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
erk
PostPosted: Mon Feb 12, 2007 6:54 am    Post subject: Thanks! Reply with quote

Newbie

Joined: 09 Feb 2007
Posts: 2

Thanks all - I was under the impression that the bytes had to be left "uninterpreted", and couldn't understand the absence of getJMSMessageIDAsBytes; and I thought I had tested that case, but obviously not. Our code is now working fine.

Thanks again!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to move messageID to reply message's correlation ID
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.