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 » Correlation Id is null in a JMS/MDB Service

Post new topic  Reply to topic
 Correlation Id is null in a JMS/MDB Service « View previous topic :: View next topic » 
Author Message
Saravana
PostPosted: Fri May 07, 2010 12:51 am    Post subject: Correlation Id is null in a JMS/MDB Service Reply with quote

Newbie

Joined: 07 May 2010
Posts: 3

For a application running on WAS 7, we have to write a message to one queue and then read the same message for further processing. It is found that an id (JMS Correlation ID) being set in the message header is not being read while traversing the message (comes up as null) using an MDB via a listener port. A standalone client/ JSP is able to read this information.

please find the code used

To post a message:
QueueConnection qc=qcf.createQueueConnection();
QueueSession qcs=qc.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
TextMessage tm=qcs.createTextMessage("Hello World!!!");
tm.setJMSCorrelationID(corrlId);

To read a message:
public void onMessage(javax.jms.Message msg) {
System.out.println(msg.getJMSCorrelationID()); -->> Returns null
....
..

}
I would like to get solution approach for this problem.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri May 07, 2010 2:45 am    Post subject: Reply with quote

Grand High Poobah

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

Well you did not specify at which point you sent the message...
So there is no way of guessing what the correlid could be.
BTW what is the value of your corrlId variable in the following line of code?:
Code:
tm.setJMSCorrelationID(corrlId);


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Saravana
PostPosted: Fri May 07, 2010 6:57 pm    Post subject: Reply with quote

Newbie

Joined: 07 May 2010
Posts: 3

Hi,

I am posting a message to the MQ Queue from my service bean (EJB) and reading it through MDB using Listener Port.


Code used to sent msg to the Queue:
...
QueueConnection qc=qcf.createQueueConnection();
QueueSession qcs=qc.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
TextMessage tm=qcs.createTextMessage("Hello World!!!");
tm.setJMSCorrelationID("10");
.....

Reading a message @ MDB onMessage():
...
public void onMessage(javax.jms.Message msg) {
System.out.println(msg.getJMSCorrelationID()); -->> Returns null
....
..
}
FYI - I am able to read the above message from JSP or any other client program. But unable to read the correlation Id in the MDB.

Please advice.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat May 08, 2010 4:14 am    Post subject: Reply with quote

Grand High Poobah

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

Again... not enough information.
We need to see the code up to and including the send method of the request message. I understand you are setting the correlId to "10"...
I would advise you to do an immediate tm.getJMSCorrelId() after the set.
You might be surprised by what you get back...

You say you are using WAS 7 but you did not specify which flavor of JMS you are using (SIBUS JMS engine, MQ V6, MQ V7)?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Saravana
PostPosted: Sun May 23, 2010 9:58 am    Post subject: Reply with quote

Newbie

Joined: 07 May 2010
Posts: 3

I am using MQ 6 and Websphere 7 listerner Port to consume the message.
I could able to read message properties, correlation id with any other client programs except MDB.

I could see the correlation ID/ message properties present in the Queue (MQ Server) as well.

But MDB consumes messages without header information. So i couldn't see any in the lister port config.

Please let me know if there is anything needs to be done in the MDB config or listenr port config?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun May 23, 2010 6:41 pm    Post subject: Reply with quote

Grand High Poobah

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

open a PMR
_________________
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 » Correlation Id is null in a JMS/MDB Service
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.