Author |
Message
|
cloidhamer |
Posted: Tue Jan 25, 2011 10:07 am Post subject: Multiple applications reading Queue |
|
|
Newbie
Joined: 02 Apr 2007 Posts: 6
|
First off thanks for any help on this. These forums are a great asset to programmers who don't live in the MQ world.
I have read that browsing is a bad idea and have never done it in any of my apps. But I now have the need to check and see if a message on the queue is mine before removing it, the data to be checked is contained in the message. I am not the in charge of the queue I am only the programmer trying to use it.
Is there an efficient way to do this? If so what are the commands?
OR
Is this a bad design for a queue and its messages?
Should I tell them that each application should have a different queue?
Thanks
Craig Loidhamer |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 25, 2011 10:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's generally recommended that every application have it's own queue.
Unless all of the data is logically the "same" data and it doesn't matter which application gets it. But then it's not clear why you have separate applications.
If someone is really insistent on sharing the same physical queue between logically discrete applications, then enforce that some property of the message (perhaps an MQ v7 Message Property that you read using a selector) is set to a unique value for your application so that you can only get the message you want, rather than having to browse the whole queue each time. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 25, 2011 11:10 am Post subject: Re: Multiple applications reading Queue |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
cloidhamer wrote: |
Is this a bad design for a queue and its messages? |
Yes it is.
cloidhamer wrote: |
Should I tell them that each application should have a different queue? |
Yes.
The only "exception" is an application that doesn't process the messages but examines the content & forwards them onto other applications to process based on that content.
But that's a false exception because such an application is in fact processing all the messages. It's just not doing business processing & that's not a valid distinction at this technical level.
Push back & ask why applications don't have their own queues. If you get any variation of the standard reason ("we're trying to keep the number of queues on the queue manager at a manageable level") reach for your trout... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mvic |
Posted: Tue Jan 25, 2011 2:05 pm Post subject: Re: Multiple applications reading Queue |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
cloidhamer wrote: |
Is there an efficient way to do this? |
Help us some more:
- what is your performance requirement?
- how deep is this queue, does it become full of old messages?
Browsing has acceptable efficiency, for some scenarios.
Using correl id to partition the queue is much preferred if you must share a queue between apps.
Correl id is much better than properties / selectors, in particular.
But none of this might be a worry if your queue is shallow, you have (say) only 10 apps getting from it, each with its own correl id, and your app is not performance-critical.
Hope this helps |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Jan 25, 2011 2:40 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
I have read that browsing is a bad idea |
Browsing is neither good nor bad. It is a choice. If your application design dictates that a message be read NON-destructively, then browsing satisfies that requirement.
Quote: |
and have never done it in any of my apps |
.
Haven't had the need so far...
Quote: |
But I now have the need to check and see if a message on the queue is mine before removing it, the data to be checked is contained in the message. I am not the in charge of the queue I am only the programmer trying to use it. |
Quote: |
Is there an efficient way to do this? If so what are the commands? |
MQGMO (get message options) is where you would specify if a message is to be browsed.
Quote: |
OR Is this a bad design for a queue and its messages? |
Again, neither good nor bad.
Quote: |
Should I tell them that each application should have a different queue? |
Multiple apps consuming from the same queue allows for more concurrent work to be processed - from that queue. Browsing is covered in great depth in the APG and APR. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
cloidhamer |
Posted: Tue Jan 25, 2011 2:54 pm Post subject: |
|
|
Newbie
Joined: 02 Apr 2007 Posts: 6
|
Wow! You guys are awesome.
I will try and and get a dedicated queue for this application.
If not you have provided me with good ways to approach the problem.
Thanks for all your help.
Craig |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 25, 2011 4:18 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's funny how, when you present a clear question and ask for help and show some effort has been put in, and then don't follow up later with increasingly demanding statements...
we can actually be helpful.
better information, better answers. |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Jan 25, 2011 9:29 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
mqjeff wrote: |
It's funny how...we can actually be helpful. |
It happens. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|