You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Kevin Burton <bu...@spinn3r.com> on 2014/07/18 00:39:23 UTC

Setting ?jms.prefetchPolicy.all=10 causes getDestinationSource().getQueues() to return with missing queues...

This must be a bug…

I have code that needs to enumerate all queues on startup.

So I call

        Set<ActiveMQQueue> queues =
connection.getDestinationSource().getQueues();

This basically returns a list of all queues which have > 1 message waiting
in them.  (or haven't been GCd yet so there might be a few with zero).

… I get queues back, but only about 40 of them.

if I just remove ?jms.prefetchPolicy.all=10

… then I get ALL of them back… something like 400.

But what could cause this?  I read about the prefect policy and I don't see
why this would impact getQueues at all.

I would think that getQueues () would be authoritative.

Is it possible that there's a race? that the ActiveMQ server is sending
advisory messages to the client, but the client hasn't processed them all
yet due to the lower prefect policy?



-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: Setting ?jms.prefetchPolicy.all=10 causes getDestinationSource().getQueues() to return with missing queues...

Posted by Kevin Burton <bu...@spinn3r.com>.
Ah.. the problem is that it's an API design bug.

getQueues() seems to imply a synchronous fetch of the queues.

So really there's no way to know if you have them all.. .

there's no startup countdown latch or anything to imply that you have a
snapshot of all the queues.

… so thats the bug essentially :)

Kevin


On Thu, Jul 17, 2014 at 5:18 PM, artnaseef <ar...@artnaseef.com> wrote:

> I don't see a bug in DestinationSource - can you be more specific what you
> see there?
>
> Since the DestinationSource is a message listener reading advisory
> messages,
> there definitely is a chance for race conditions.  And smaller prefetch
> values can significantly slow down delivery of the advisories.
>
> Note that the initial creation of an advisory subscription receives a
> message for every destination already known to the broker.
>
> Please advise on what you see.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Setting-jms-prefetchPolicy-all-10-causes-getDestinationSource-getQueues-to-return-with-missing-queue-tp4683383p4683385.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: Setting ?jms.prefetchPolicy.all=10 causes getDestinationSource().getQueues() to return with missing queues...

Posted by artnaseef <ar...@artnaseef.com>.
I don't see a bug in DestinationSource - can you be more specific what you
see there?

Since the DestinationSource is a message listener reading advisory messages,
there definitely is a chance for race conditions.  And smaller prefetch
values can significantly slow down delivery of the advisories.

Note that the initial creation of an advisory subscription receives a
message for every destination already known to the broker.

Please advise on what you see.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Setting-jms-prefetchPolicy-all-10-causes-getDestinationSource-getQueues-to-return-with-missing-queue-tp4683383p4683385.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Setting ?jms.prefetchPolicy.all=10 causes getDestinationSource().getQueues() to return with missing queues...

Posted by Kevin Burton <bu...@spinn3r.com>.
Oh wow… that's exactly the problem.

The DestinationSource adds a message listener and then receives all the
messages…

This means that even if I change the current prefetch policy, I'll still
eventually run into this bug.

This is definitely a bug though.. this is essentially a race condition on
startup with , what seems like, no way to block for the ability to figure
out when I have all queues discovered.


On Thu, Jul 17, 2014 at 3:39 PM, Kevin Burton <bu...@spinn3r.com> wrote:

> This must be a bug…
>
> I have code that needs to enumerate all queues on startup.
>
> So I call
>
>         Set<ActiveMQQueue> queues =
> connection.getDestinationSource().getQueues();
>
> This basically returns a list of all queues which have > 1 message waiting
> in them.  (or haven't been GCd yet so there might be a few with zero).
>
> … I get queues back, but only about 40 of them.
>
> if I just remove ?jms.prefetchPolicy.all=10
>
> … then I get ALL of them back… something like 400.
>
> But what could cause this?  I read about the prefect policy and I don't
> see why this would impact getQueues at all.
>
> I would think that getQueues () would be authoritative.
>
> Is it possible that there's a race? that the ActiveMQ server is sending
> advisory messages to the client, but the client hasn't processed them all
> yet due to the lower prefect policy?
>
>
>
> --
>
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
> <http://spinn3r.com>
>
>


-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>