Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A question about triggering. Is

Status
Not open for further replies.

landtiller

Programmer
Feb 5, 2003
3
0
0
CA
A question about triggering.

Is it possible to start an instance of an application for every nth message on a queue? For example if 15 messages are put on a queue can the trigger be configured to start one instance of an application for every 5 messages? I envision the applications processing the messages then closing after a specified amount of time.

None of the documentation I have seen seems to allow for this. Any suggestions?

Thanks
 
Yes it is possible. You can trigger on DEPTH.

One word of caution here though....remember that if the depth doesn't reach the depth number specified then the messages will stay on the queue until they do. What I mean is that if you specify a depth of 10 and only get 9 messages on the queue then the application will never get triggered.
 
From what I understand of the DEPTH trigger type, once the message depth is reached the trigger message is sent and triggering is disabled and must be re-enabled using MQSET. I don't believe this use of DEPTH helps me because if, for example, the depth is 5 and I recieve 15 messages only one instance of the application is started and it will process all 15 messages by itself. I would like to start (in this case) 3 instances of the application which will all get messages from the application queue and then close down.

What I would like to do is analogous to what trigger type EVERY does but for every nth message, not every single message.
 
In that case I suspect you will need to write some intelligence into the process yourself. What platform are you wanting to do this on?

I had to write similar logic into my z/OS trigger monitor but for a different reason. In my case I only wanted the first message to fire the trigger but couldn't use trigger FIRST or DEPTH because the queues were open by a 24x7 application (WORKFLOW). Triggering EVERY wasn't really what we wanted as we only needed to know that we had a messages on the queue so that we could deal with them manually so we had to write intelligence into the monitor program so that only the FIRST of EVERY got processed until we set a trigger flag again.

What you are trying to do is something I have seen many people want to do (and understandably) but as it comes out of the box MQ doesn't provide this flexibility yet.
 
Right. It seems the only way around this is to have the trigger monitor program get the current queue depth and then decide, based on some application preference, if it should call one or more additional instances of the queue process program.

Thanks for the help. It seemed such a basic issue that I expected MQ would have some way of addressing it itself, but I guess not.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top