Author |
Message
|
raviseera |
Posted: Wed Dec 10, 2008 4:34 am Post subject: How can i retrieve jms message from queue using corrlId |
|
|
Novice
Joined: 10 Dec 2008 Posts: 10
|
Our service is now getting MQ messages(Using MDBs and Websphere applicaton server) without defining correlation ID, which means our service simply consume all messages in a MQ queue one-by-one, until the queue is empty. Then, my question is:
Is it possible to support reading MQ messages
with correlation ID? (it should be configrable, so that different beans
can choose whether to use correlation ID or not)
i.e., I want to read the specific message from queue based on Correlation ID. If it is possible then how can i configure this one or what changes i need to made in my application. Please give me your valuable suggestionns on this issue.
It is very very very urgent. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 10, 2008 4:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Moved to Java section _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Dec 10, 2008 7:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Read the section in the using Java manual about MessageSelector.
Make sure that you define the message selector with the provider type information (JMSCorelId="ID:hexvalueofbytearray") especially if you are below version 7. (Huge performance implications.)
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
raviseera |
Posted: Wed Dec 10, 2008 9:45 pm Post subject: Hi |
|
|
Novice
Joined: 10 Dec 2008 Posts: 10
|
Thank you very much
But, still i have one question.
Is it best practide to consume JMS message with correlation id? Because, some times correlation id may be null
What is actual meaning of correlation id
Please suggest me with your valuable inputs |
|
Back to top |
|
 |
Vitor |
Posted: Thu Dec 11, 2008 12:41 am Post subject: Re: Hi |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
raviseera wrote: |
What is actual meaning of correlation id |
CorrelId (in Java or other programs) is used to identify one message as connected (having a correlation with another. Most typically it's used to identify a reply to a request; an application will make a request & will identify it's reply from the available replies by selecting the one with "it's" request id in the correl id.
This is explained, in slightly better English and with diagrams, in the Intercommunication manual.
As to if it's best practice, it's one of the 2 ways to recieve a reply. The other is with temporary dynamic queues. Which is best is a design decision you must make locally. Both methods have pros and cons. The search feature will turn up some possibly useful debates on the forum.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
raviseera |
Posted: Thu Dec 11, 2008 12:48 am Post subject: Message Selector problem |
|
|
Novice
Joined: 10 Dec 2008 Posts: 10
|
Thank you Very much,
I have one more doubt.
Can i consume the message from MQ with particular field.
Ex: <Even CampaignName = "Ravi"></Event>
Is it possible to consume the message with CampaignName="Ravi"
Please help me on this one |
|
Back to top |
|
 |
atheek |
Posted: Thu Dec 11, 2008 2:17 pm Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
Yes you can do that. You can set up the selectors in some special headers in the message called RF Headers. Read using java guide to understand how to do this.
However, performance wise I think this is not that much recommended. |
|
Back to top |
|
 |
raviseera |
Posted: Thu Dec 11, 2008 9:28 pm Post subject: |
|
|
Novice
Joined: 10 Dec 2008 Posts: 10
|
Can u expain on this one
Performance wise, why it is not recommended
Your valuable suggestions and inputs are very helpful for me |
|
Back to top |
|
 |
Vitor |
Posted: Fri Dec 12, 2008 12:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
raviseera wrote: |
Performance wise, why it is not recommended
|
Because a queue manager is not a database. Put simply and to continue the database analogy, to read like this requires the queue manager to do a "tablescan" down the queue. Any DBA on any database platform will tell you this is an inefficient and resource hungry activity.
A lot depends here on how deep you think your queue will be. You'll find (again simplistically) that performance will degrade exponentially as the queue depth increases.
A queue manager is designed to deliver messages. It's good at it. A database is designed to find information based on key values. It's good at it. 2 different software solutions for 2 different problems.
Hope that helps.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|