ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » Could MQ do a trigger when consumer disconnected with queue?

Post new topic  Reply to topic
 Could MQ do a trigger when consumer disconnected with queue? « View previous topic :: View next topic » 
Author Message
ioat
PostPosted: Tue Oct 23, 2007 6:23 pm    Post subject: Could MQ do a trigger when consumer disconnected with queue? Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

I have the following requirement.

Start one process to listen to a queue, if the process died (eg: exit abnormally). I want to auto start the same process on another machine to listen to the same queue, to continue processing the messages.

So I want to know, when the first process disconnect with queue, whether MQ can trigger another process to auto start another message consumer.

PS, I'm using the C language to access the MQ.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Tue Oct 23, 2007 6:54 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

You cannot do this out of MQ. This is a job for your monitoring software.

A = the condition(s) that indicate your primary process is "dead".
Set up your monitor to alert when condition A exits.
When it alerts it should also start up your secondary process.

How will you insure that your primary process won't start back up while your secondary one is running? Don't say the app will open the q for exclusive gets because its possible the app could hang with the q open and then how would your secondary app be able to open the queue?
If both can run concurrently then why not have both running all the time?

Your alerting scenario needs to handle the primary process abending and dropping its connection from the queue, as well as the primary process dying and leaving an open handle on the queue. All of the sudden this requirement is quite so simple, eh?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
ioat
PostPosted: Tue Oct 23, 2007 7:08 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

I couldn't monitor my primary process, as if the monitor process and my primary process stay on the same machine, if the machine crashed, how the monitor process notify my secondary process.

I need to process messages sequently, if start two processes concurrently, the sequence will be lost, right?

Could I let the secondary process browse the message intervally? If the first message has not been processed for a while, then assume the primary process is died. Of course, don't know whether it has hung.

Any other comments?
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Tue Oct 23, 2007 7:11 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Primary Proccess lives on Server A. Secondary Process lives on Server B and they both MQClient connect to the Queue Manager on Server C?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
ioat
PostPosted: Tue Oct 23, 2007 7:16 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

Yes, that's my env.
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Tue Oct 23, 2007 7:23 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Looking at just the queue, how would you know you need to start up the secondary process?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
ioat
PostPosted: Tue Oct 23, 2007 7:33 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

Just like I said above. One way maybe I can monitor the first message in the queue, if it has not been processed for some time. Then the second process can be started.

If not consider the process hang, does it has any other faults?

Whether can monitor the IPPROCS?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 23, 2007 8:21 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ioat wrote:
Just like I said above. One way maybe I can monitor the first message in the queue, if it has not been processed for some time. Then the second process can be started.

If not consider the process hang, does it has any other faults?

Whether can monitor the IPPROCS?


If the connection is dead just monitoring for ipprocs won't help much.
It is better to monitor for ipprocs and dequeue rate or even only on dequeue rate...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ioat
PostPosted: Tue Oct 23, 2007 9:12 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

So I can only check whether the first message has been processed for some time, right?
Back to top
View user's profile Send private message
Nigelg
PostPosted: Tue Oct 23, 2007 10:03 pm    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

You can use queue service interval events to monitor how long msgs remain on a queue.

WARNING: Many users have found it rather an advanced topic.
_________________
MQSeries.net helps those who help themselves..
Back to top
View user's profile Send private message
ioat
PostPosted: Tue Oct 23, 2007 10:38 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

Not familiar with queue service interval.

Is it the similar effect to browse and check whether the first message has not been processed for some time?
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Wed Oct 24, 2007 3:52 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

In MQ 6.0, QSTATUS can tell you how long the oldest message on the queue is. You could alert on that.
Quote:

MSGAGE
Age, in seconds, of the oldest message on the queue. The maximum displayable value is 999 999 999; if the age exceeds this value, 999 999 999 is displayed.
This parameter is also displayed when you specify the MONITOR parameter.

A value is only displayed for this parameter if MONQ is set for this queue.


Your monitor could alert on any or all of these conditions:
A. MSGAGE > x seconds (you decide what x is)
or
B. IPROCS = 0
or
C. QDEPTH > 0 and Dequeue Rate < 1


(A is redundant if you monitor for both B and C)
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
ioat
PostPosted: Wed Oct 24, 2007 5:22 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

Thanks for your good suggestions.

How could I monitor and fire the alert? Does MQ has the build-in alert mechanism or I need to program to monitor these attributes periodly?
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Wed Oct 24, 2007 7:46 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

MQ does not have any built in functionality to do this.

Any half decent MQ monitoring software can do it. Or you can reinvent the wheel and try and code it yourself. Research "PCF Messages" on how you can detrmine if conditions A thru C exist. How you then alert yourself and fire up the secondary process is not specific to MQ.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
ioat
PostPosted: Wed Oct 24, 2007 8:18 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2005
Posts: 53

Got it, thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Could MQ do a trigger when consumer disconnected with queue?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.