Author |
Message
|
Saravana |
Posted: Fri May 07, 2010 12:51 am Post subject: Correlation Id is null in a JMS/MDB Service |
|
|
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 |
|
 |
fjb_saper |
Posted: Fri May 07, 2010 2:45 am Post subject: |
|
|
 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 |
|
 |
Saravana |
Posted: Fri May 07, 2010 6:57 pm Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sat May 08, 2010 4:14 am Post subject: |
|
|
 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 |
|
 |
Saravana |
Posted: Sun May 23, 2010 9:58 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Sun May 23, 2010 6:41 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
open a PMR  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|