Hi,

can you create patch and raise Jira, so it doesn't get lost in emails?


Regards
-- 
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: [email protected]
Web: http://fusesource.com
Twitter:  http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Fri, Mar 11, 2011 at 10:36 PM, robstocks <[email protected]> wrote:

> Proposed small change to org.apache.activemq.broker.region.Queue
> addSubscription() method:
>
> If the new consumer is exclusive and has the maximum priority (127),
> replace
> the existing exclusive consumer even if it also has a priority of 127 as
> follows (line 385 in version 5.4.2 source):
>
> if (exclusiveConsumer == null) {
>  exclusiveConsumer = sub;
> } else if (sub.getConsumerInfo().getPriority() >
> exclusiveConsumer.getConsumerInfo().getPriority()) {
>  exclusiveConsumer = sub;
> } else if (sub.getConsumerInfo().getPriority() == Byte.MAX_VALUE) {
>  exclusiveConsumer = sub;
> }
>
> This allows new consumers to always replace any existing exclusive consumer
> (but preserves behaviour in all but 1 unusual case). There may be a better
> way of donig this (e.g. adding an ExclusiveMode property to ConsumerInfo
> with values such as 'PRIORITY', 'NEWEST' which determines whether the
> priority is checked or the latest exclusive consumer replaces an y existing
> one) but the above is a quick fix for this problem.
>
> The reason, we have added this to our implementation is that we have an
> application that uses a STOMP client on Windows Mobile to post messages to
> a
> queue and wait for the reply. However, when the device goes to sleep, the
> TCP socket remains open on the server even though it is forceably closed on
> wake-up on the client. The client then creates a new connection and we end
> up with multiple consumers on our queue with new messages being distributed
> between them. If we turn on exclusivity, the original consumer gets all the
> messages which doesn't help (it actually makes it worse).
>
> If anyone has any thoughts or recommendations or can suggest any other way
> to achieve this, I would be grateful for your help.
>
> We also have a STOMP client written in C# which we are happy to release the
> source code to if anyone is interested and wants to improve it.
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Exclusive-Consumers-tp3349164p3349164.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Reply via email to