You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by David Sitsky <si...@nuix.com> on 2008/02/14 00:13:41 UTC

Question about Queue.removeSubscription()

I just noticed while looking at Queue.removeSubscription(), that it goes 
through pagedInMessages, and effectively redelivers all messages that 
were locked by the removed subscription.

My question is why is this necessary?  From my understanding in the code 
(which may be flawed), these messages will be present in the pending 
lists of all the other current subscribers, so they should eventually 
dispatch this message since the messages are now unlocked.

I know we call node.incrementRedeliveryCounter() to indicate that the 
message is being redelivered - but it seems to me that we can avoid 
redelivering these messages which seems desirable, since some consumers 
may see the same message twice.

-- 
Cheers,
David

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com                            Fax: +61 2 9212 6902

Re: Question about Queue.removeSubscription()

Posted by David Sitsky <si...@nuix.com>.
> The reason for redelivering messages when a subscription is removed is 
> because other subscriptions may have originally disocunted those 
> messages because they were locked when they came to try and dispatch them.

That's interesting... because with the current code these messages are 
left on the pending list.  What you say makes sense for a better 
implementation.

> The whole Queue dispatch model is not very scalable because each message 
> is being delivered to each subscription - this, I think was done because 
> it made the implementation of exclusive consumer easier.
> I'm currently moving away from this model - to decide at  Queue dispatch 
> time which subscription should get the message - just like a - well a 
> Queue!

I think that makes a lot of sense!  I want my application to scale to 32 
or 64 consumers hammering away, and with the current implementation, I 
can't see that happening.

It all sounds great Rob - any rough ideas when this might ready?  Let me 
know and I'll give it a good workout. :)

Cheers,
David



Re: Question about Queue.removeSubscription()

Posted by Rob Davies <ra...@gmail.com>.
On Feb 13, 2008, at 11:13 PM, David Sitsky wrote:

> I just noticed while looking at Queue.removeSubscription(), that it  
> goes through pagedInMessages, and effectively redelivers all  
> messages that were locked by the removed subscription.
>
> My question is why is this necessary?  From my understanding in the  
> code (which may be flawed), these messages will be present in the  
> pending lists of all the other current subscribers, so they should  
> eventually dispatch this message since the messages are now unlocked.
>
> I know we call node.incrementRedeliveryCounter() to indicate that  
> the message is being redelivered - but it seems to me that we can  
> avoid redelivering these messages which seems desirable, since some  
> consumers may see the same message twice.
>
> -- 
> Cheers,
> David
>
> Nuix Pty Ltd
> Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280  
> 0699
> Web: http://www.nuix.com                            Fax: +61 2 9212  
> 6902

The reason for redelivering messages when a subscription is removed is  
because other subscriptions may have originally disocunted those  
messages because they were locked when they came to try and dispatch  
them.
The whole Queue dispatch model is not very scalable because each  
message is being delivered to each subscription - this, I think was  
done because it made the implementation of exclusive consumer easier.
I'm currently moving away from this model - to decide at  Queue  
dispatch time which subscription should get the message - just like a  
- well a Queue!

cheers,

Rob