Author |
Message
|
DanielSonFocus |
Posted: Mon Jul 18, 2005 5:59 am Post subject: Question about Triggering |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
Hi... i have a novice question about triggering in MQ... With respect to the FIRST, EVERY and DEPTH values that can be set for the trigger type attribute, which would be the most appropriate for the following situation? Say i have my TRIGTYPE set to FIRST on a local queue and it triggers my app; my app starts processing messages and then hits a fatal exception with 5 messages left to be processed on the queue. Will my app be re-triggered or should i be using a different TRIGTYPE? (FYI.. i've attempted this and my app is only getting triggered if there is one message on the queue.) Could DEPTH be an answer to this problem, or is it possible that the queue can fill up past the DEPTH value and the same problem might occur in this situation. I'd rather not use EVERY because i understand that it spins a new thread for each message, i think that's overkill for the problem im solving. |
|
Back to top |
|
 |
wschutz |
Posted: Mon Jul 18, 2005 6:07 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
FIRST is what you want. When you application ends (either nicely or due to an exception), the queue will be closed (eventually) and then MQ wll retrigger your application (if trigtype=first and there are still messages on the queue and the last application that had the queue open closes the queue, then a new trigger event is created).
You application probably should check BackoutCount on the messages to see if they have been processed before (to keep from getting into a poison message loop condition). _________________ -wayne
Last edited by wschutz on Mon Jul 18, 2005 6:26 am; edited 1 time in total |
|
Back to top |
|
 |
sebastianhirt |
Posted: Mon Jul 18, 2005 6:08 am Post subject: |
|
|
Yatiri
Joined: 07 Jun 2004 Posts: 620 Location: Germany
|
Hi,
My personal opinion is that 'every' is only in rare cases usefull. It produces tons of trigger events, starts loads of new processes...
Depth I would only use when messages are not time critical, as this is sort of batch-like-processing.
I would go for first (as you already do).
When using Triggertype first a triggerevent will always occur when the depth changes from 0 to 1. Alternativley switching the trigger off and on again will also result in a triggerevent.
Hope this helps
Sebastian |
|
Back to top |
|
 |
Nigelg |
Posted: Mon Jul 18, 2005 6:20 am Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
TRIGTYPE(FIRST) will work OK.
If the app reading msgs from the queue dies and there are still msgs on the queue, another trigger msg will be generated when the queue is closed on behalf of the app by the qmgr agent process. See trigger condition 12 in the APG. |
|
Back to top |
|
 |
queuetip |
Posted: Tue Aug 01, 2006 8:34 am Post subject: |
|
|
 Acolyte
Joined: 03 Feb 2005 Posts: 67
|
sebastianhirt wrote: |
Alternativley switching the trigger off and on again will also result in a triggerevent. |
This is interesting...some questions:
1. Can I do this programmatically (via MQSET) to the queue if I already have opened the queue for input?
2. If so, does the trigger occur immediately (before I close the queue)?
3. If the application turns it off, then immediately turns it on again before closing the close, will a trigger still get generated and if so at what point?
4. Do you have to start and stop/the queue manager?
Across all platforms?
Thanks,
Mike  |
|
Back to top |
|
 |
queuetip |
Posted: Tue Aug 01, 2006 8:45 am Post subject: |
|
|
 Acolyte
Joined: 03 Feb 2005 Posts: 67
|
wschutz wrote: |
FIRST is what you want. When you application ends (either nicely or due to an exception), the queue will be closed (eventually) and then MQ wll retrigger your application (if trigtype=first and there are still messages on the queue and the last application that had the queue open closes the queue, then a new trigger event is created).
You application probably should check BackoutCount on the messages to see if they have been processed before (to keep from getting into a poison message loop condition). |
Hi wschutz - Triggering is just seems to be more complicated than it has to be. I think this contradicts what I am hearing on another post. Do you have time to weigh in on the topic discussion? Here's the link:
http://www.mqseries.net/phpBB2/viewtopic.php?t=30974&highlight=
Thanks! Mike  |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue Aug 01, 2006 6:26 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
queuetip wrote: |
sebastianhirt wrote: |
Alternativley switching the trigger off and on again will also result in a triggerevent. |
This is interesting...some questions:
1. Can I do this programmatically (via MQSET) to the queue if I already have opened the queue for input?
|
You could, but it won't accomplish anything. If the Triggered OnFirst Q is open for input, you won't get a trigger event by turn triggering on and off. The triggering conditions are not being met. Easy enough to test.
queuetip wrote: |
2. If so, does the trigger occur immediately (before I close the queue)?
|
See #1
queuetip wrote: |
3. If the application turns it off, then immediately turns it on again before closing the close, will a trigger still get generated and if so at what point?
|
See #1
queuetip wrote: |
4. Do you have to start and stop/the queue manager?
Across all platforms?
|
You never have to bounce the QM to accomplish anything with triggering. Ever. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Aug 02, 2006 3:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
How about if you change the trigint property of the qmgr? _________________ MQ & Broker admin |
|
Back to top |
|
 |
|