activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: Question about Queue.removeSubscription()
Date Thu, 14 Feb 2008 07:34:36 GMT

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

Mime
View raw message