activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amp834 <amp...@rqinc.com>
Subject Re: How to tell if everything in a queue has been processed
Date Thu, 10 Sep 2009 13:38:32 GMT

Hi Rob, & thanks for the info.

That post references a doc that I can't find, 
http://svn.apache.org/repos/asf/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java

I'm not sure if the bean mentioned in http://activemq.apache.org/jmx.html
gives the messages that have been "not committed/consumed yet" (if a message
has been delivered, but the client has not yet committed, I need to count
that as "still unfinished")

The original post also mentions "Or you can just grab a reference to the
ActiveMQ Broker object itself and navigate that if you are in the same
process."
Is there something simple I can do to a broker to make it realize when a
queue has become empty and have it send a message?  (I would need it to test
if some "TestForEoq" flag is enabled; I would disable it while writing tasks
to the queue). 

Alternately, I can write a "test for end of queue" message at the end of
writing all the tasks for a queue, and whoever consumes that message would
check the queue, if it's not empty, write another "test for end of queue"
message (preferably with a "delayed delivery", if ActiveMq allows that now;
JBOSS seems to allow delayed delivery of individual messages, but I haven't
found anything simple in ActiveMq).

I'm new to ActiveMq, and am not sure what paths are easiest.  Any help would
be greatly appreciated!


rajdavies wrote:
> 
> 
> On 9 Aug 2009, at 15:32, amp834 wrote:
> 
>>
>> I'm using ActiveMQ to "Submit a job" to queue "Job53" (a queue for  
>> each job),
>> with (say) 500 subtasks, and want to know when the 500 items have been
>> processed completely.  I thought of creating a queue just for that  
>> job,
>> writing 500 messages to it, and when the 500 messages have been  
>> processed,
>> the job is done.
>>
>> Is there a way to tell if a queue is empty?  (no messages in the  
>> queue, no
>> messages that a consumer has taken but has not finished processing)?
>>
>> I found an old post, but it's so old that I thought I'd ask the  
>> question
>> again.
>> http://www.nabble.com/Query-the-number-of-messages-from-a-Queue-to3652780.html#a3653404
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-tell-if-everything-in-a-queue-has-been-processed-tp24887648p24887648.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> 
> You can either use JMX - as the old post suggested - or enable message  
> consumed advisory - to get informed out when a message has been  
> consumed from the queue - see
> http://activemq.apache.org/advisory-message.html
> 
> cheers,
> 
> Rob
> 
> Rob Davies
> I work here: http://fusesource.com
> My Blog: http://rajdavies.blogspot.com/
> I'm writing this: http://www.manning.com/snyder/
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-tell-if-everything-in-a-queue-has-been-processed-tp24887648p25383479.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message