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 » IBM MQ Java / JMS » Check whether queues are empty?

Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next
 Check whether queues are empty? « View previous topic :: View next topic » 
Author Message
koen.jans
PostPosted: Wed Oct 17, 2007 3:50 am    Post subject: Reply with quote

Novice

Joined: 16 Oct 2007
Posts: 12

jefflowrey wrote:
This is what I would do.

Propagate a version of the "stop processing" message to each of the internal queues.

As each MDB receives that "stop processing" message, it tells the listener port to stop.

Once the listener port for the MDB is stopped, it will send a reply back to the front end receiver, which when all replies are ready will then send response to external system.

Because the stop processing message will be the last message sent by the front end, it will be the last message on the queue...


This solution will not work since messages on internal queues 1,2,3 might post messages to internal queues 1,2,3.

Suppose the external queue is stopped, so no new messages are arriving from that queue.
We now want to know when all internal processing is done.
If we send the stop messages, queues can look like:
Code:
1: M1 STOP
2: M2 M3 STOP
3: M4 STOP


when for instance queue 3 processes M4, it can put messages on queue 1.
Code:
1: M1 STOP M5
2: M2 M3 STOP
3: STOP


So queue 1 will be stopped before all processing that was on the queues is performed.
(Note that the internal queues do not have to be stopped, i just need to know when they are all empty and all processing is done)
Back to top
View user's profile Send private message
Michael Dag
PostPosted: Wed Oct 17, 2007 4:41 am    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

koen.jans wrote:

This solution will not work since messages on internal queues 1,2,3 might post messages to internal queues 1,2,3.

because of this, whatever you come up with, it will 'hold' one day an no one knows what happened or how to 'restart'.

Just look at what needs to be done when an update can not be processed,
set it aside for reprocessing, this will get rid of affinity and your users will be able to fix it when something goes wrong...
_________________
Michael



MQSystems Facebook page
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
koen.jans
PostPosted: Wed Oct 17, 2007 4:54 am    Post subject: Reply with quote

Novice

Joined: 16 Oct 2007
Posts: 12

Michael Dag wrote:
koen.jans wrote:

This solution will not work since messages on internal queues 1,2,3 might post messages to internal queues 1,2,3.

because of this, whatever you come up with, it will 'hold' one day an no one .


This is not really true since there will never be "loops" like this in the processing on the internal queue. For instance 1 might post a message to 3, but 3 will never post a message to 1.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Oct 17, 2007 4:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Set the stop messages to a lower priority than the rest of the messages.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
koen.jans
PostPosted: Wed Oct 17, 2007 5:07 am    Post subject: Reply with quote

Novice

Joined: 16 Oct 2007
Posts: 12

jefflowrey wrote:
Set the stop messages to a lower priority than the rest of the messages.


This is also not correct, for instance:

Code:

1: M1 M2 M3 M4 STOP
2: M5 STOP


Suppose M4 sends a message M6 to 2.
But before queue 1 processes message M4, queue 2 has already received the STOP message, although it has a low priority.
And we'll think queue 2 is done processing, while M6 still is being processed on queue 2.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Oct 17, 2007 5:18 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

And checking on qdepth will have exactly the same problem.

Just remove the STOP from those two lists, and you'll see.

You need to figure out the dependency order to know how to handle this. And then decide what kind of signaling mechanism you want to use, to implement the dependency chain.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
koen.jans
PostPosted: Wed Oct 17, 2007 6:42 am    Post subject: Reply with quote

Novice

Joined: 16 Oct 2007
Posts: 12

jefflowrey wrote:
And checking on qdepth will have exactly the same problem.


Hmm, i can do a check then that ALL queues 1, 2 AND 3 are empty, so that's not the same problem (i think?)
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Oct 17, 2007 6:45 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

No, because then you don't know if you're supposed to stop or if stuff is just slow right now.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Oct 17, 2007 6:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

koen.jans wrote:
jefflowrey wrote:
And checking on qdepth will have exactly the same problem.


Hmm, i can do a check then that ALL queues 1, 2 AND 3 are empty, so that's not the same problem (i think?)


But if all 3 queues are empty, how do you know something's not chewing on the last message that arrived on queue n, and will any moment write another message out?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
koen.jans
PostPosted: Wed Oct 17, 2007 6:54 am    Post subject: Reply with quote

Novice

Joined: 16 Oct 2007
Posts: 12

Vitor wrote:

But if all 3 queues are empty, how do you know something's not chewing on the last message that arrived on queue n, and will any moment write another message out?



Good point.
I'll try to come up with something, thanks for your suggestions both!
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 17, 2007 2:45 pm    Post subject: Reply with quote

Grand High Poobah

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

How about Input is stopped and 1,2&3 have been empty for the last 15 seconds?

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Oct 17, 2007 2:55 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

fjb_saper wrote:
How about Input is stopped and 1,2&3 have been empty for the last 15 seconds?


Remember that 1,2,&3 are serviced by MDBs. So this would require starting a new thread, or issuing a sleep(), inside an MDB onMessage().

Are you sure this is what you want?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 17, 2007 2:57 pm    Post subject: Reply with quote

Grand High Poobah

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

jefflowrey wrote:
fjb_saper wrote:
How about Input is stopped and 1,2&3 have been empty for the last 15 seconds?


Remember that 1,2,&3 are serviced by MDBs. So this would require starting a new thread, or issuing a sleep(), inside an MDB onMessage().

Are you sure this is what you want?
Woudn't you be using the thread that shutdown the input MDB for that check? (Observer pattern)
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Oct 17, 2007 3:05 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

fjb_saper wrote:
Woudn't you be using the thread that shutdown the input MDB for that check? (Observer pattern)


Only if I could guarantee that all of the MDB instances were running in the same server instance on the same machine against the same qmgr...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 17, 2007 3:16 pm    Post subject: Reply with quote

Grand High Poobah

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

jefflowrey wrote:
fjb_saper wrote:
Woudn't you be using the thread that shutdown the input MDB for that check? (Observer pattern)


Only if I could guarantee that all of the MDB instances were running in the same server instance on the same machine against the same qmgr...


I think you are being a little too restrictive here. I would have just said running against the same qmgr....

It is then your problem how you instruct the MDB's running in other JVMs to shut down... (via some stateless ejb?)
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next Page 2 of 3

MQSeries.net Forum Index » IBM MQ Java / JMS » Check whether queues are empty?
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.