You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by sks <St...@sas.com> on 2014/06/27 19:34:35 UTC

Number of consumers question

I am testing durable topics.

I'm using the JAVA to programatically create the topic and the durable
subscriber.
The test closes the subscriber, session and connection and then exits

If i use the ActiveMQ web console, it still shows the number of consumers at
1.
I would have expected this to have gone to 0 now that the Java program has
exited.

Then i use another program to send a couple messages to this topic
The offline subscriber shows enqueue of 2 which is what I expect as they are
sitting on there.
This program exits

Now I run the consumer program again.
It consumes the two messages as I would expect.
But if I go back to the admin console for activeMQ (topic screen), it still
shows consumers as 1, enqueue of 2 and dequeue of 0.

I don't understand why this dequeue is set to 0 .
If I look at the subscriber screen, it shows the enqueue/dequeue of 2 as I
expect.

Any ideas on this?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Number-of-consumers-question-tp4682575.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Number of consumers question

Posted by Gary Tully <ga...@gmail.com>.
are you sure you are acking the messages?

On 27 June 2014 18:34, sks <St...@sas.com> wrote:
> I am testing durable topics.
>
> I'm using the JAVA to programatically create the topic and the durable
> subscriber.
> The test closes the subscriber, session and connection and then exits
>
> If i use the ActiveMQ web console, it still shows the number of consumers at
> 1.
> I would have expected this to have gone to 0 now that the Java program has
> exited.
>
> Then i use another program to send a couple messages to this topic
> The offline subscriber shows enqueue of 2 which is what I expect as they are
> sitting on there.
> This program exits
>
> Now I run the consumer program again.
> It consumes the two messages as I would expect.
> But if I go back to the admin console for activeMQ (topic screen), it still
> shows consumers as 1, enqueue of 2 and dequeue of 0.
>
> I don't understand why this dequeue is set to 0 .
> If I look at the subscriber screen, it shows the enqueue/dequeue of 2 as I
> expect.
>
> Any ideas on this?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Number-of-consumers-question-tp4682575.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com

Re: Number of consumers question

Posted by "manuele.simi" <ma...@campagnelab.org>.
sks wrote
> I am testing durable topics.
> 
> I'm using the JAVA to programatically create the topic and the durable
> subscriber.
> The test closes the subscriber, session and connection and then exits
> 
> If i use the ActiveMQ web console, it still shows the number of consumers
> at 1.
> I would have expected this to have gone to 0 now that the Java program has
> exited.

That's exactly how durable subscribers work. They are durable, meaning that
they survive to the process that creates them. If you want a subscriber is
removed when it is offline, just do no create a durable one. 


sks wrote
> Then i use another program to send a couple messages to this topic
> The offline subscriber shows enqueue of 2 which is what I expect as they
> are sitting on there.
> This program exits
> 
> Now I run the consumer program again.
> It consumes the two messages as I would expect.
> But if I go back to the admin console for activeMQ (topic screen), it
> still shows consumers as 1, enqueue of 2 and dequeue of 0.
> 
> I don't understand why this dequeue is set to 0 .
> If I look at the subscriber screen, it shows the enqueue/dequeue of 2 as I
> expect.
> 
> Any ideas on this?

I'm not sure about this second question. It seems related to the way the
consumer informs the broker that all messages are now consumed and don't
need to be redelivered. This usually depends on the way you create the
session in the connection at the consumer side., if it is transacted or not,
if you commit or ack it after the consumer receives a message.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Number-of-consumers-question-tp4682575p4682731.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Number of consumers question

Posted by Paul Gale <pa...@gmail.com>.
Assuming a consumer is acknowledging messages correctly then the only time
I have seen the dequeue count on the topics page of the web console be
non-zero is when consumers are using transactions. That's been my
experience. Not sure why though.

Regardless, what dequeue count do you expect to see when there are, say, 10
subscriptions to the same topic and you're looking at a topic wide dequeue
count?

For a topic a dequeue count only really makes sense on a per subscription
basis (as seen on the subscribers page) especially considering that each
subscription to the same topic would most likely have been created at
different points in time.

However, the dequeue count for a queue is, of course, completely
unambiguous.


On Wed, Jul 2, 2014 at 10:34 AM, sks <St...@sas.com> wrote:

> I am setting AUTO_ACKNOWLEDGE via
>   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>
>
> If i look at the subscriber view, I see that the message was
> enqueued/dequeued. As expected.
>
> It is only when I look at the Topic, that the dequeue counter is always 0.
> Maybe if its a durable topic, the dequeue counter is always 0? I never see
> this counter incremented.
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Number-of-consumers-question-tp4682575p4682734.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Number of consumers question

Posted by Christian Posta <ch...@gmail.com>.
Because there is no notion of topics "dequeuing" messages. Topics deliver
to subscribers, if there are any. The dispatched/inflight/dequeued metrics
of a specific topic subscription is what has meaning.


On Wed, Jul 2, 2014 at 7:34 AM, sks <St...@sas.com> wrote:

> I am setting AUTO_ACKNOWLEDGE via
>   session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>
>
> If i look at the subscriber view, I see that the message was
> enqueued/dequeued. As expected.
>
> It is only when I look at the Topic, that the dequeue counter is always 0.
> Maybe if its a durable topic, the dequeue counter is always 0? I never see
> this counter incremented.
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Number-of-consumers-question-tp4682575p4682734.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
http://fabric8.io
twitter: @christianposta

Re: Number of consumers question

Posted by sks <St...@sas.com>.
I am setting AUTO_ACKNOWLEDGE via
  session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);


If i look at the subscriber view, I see that the message was
enqueued/dequeued. As expected.

It is only when I look at the Topic, that the dequeue counter is always 0.
Maybe if its a durable topic, the dequeue counter is always 0? I never see
this counter incremented.





--
View this message in context: http://activemq.2283324.n4.nabble.com/Number-of-consumers-question-tp4682575p4682734.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.