[ 
https://issues.apache.org/jira/browse/AMQ-6456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15551469#comment-15551469
 ] 

Gary Tully commented on AMQ-6456:
---------------------------------

the exclusive *choice* is local to a broker.
If there are two brokers networked together and two consumers connecting to 
each broker, there is race to figure which consumer gets all the messages.
Each consumer has a corresponding "forwarding" consumer on the other broker. It 
is the forwarding consumer that has to be deemed locally exclusive if messages 
are to get bridged. This is totally timing dependent. The forwarding consumer 
may well not be the exclusive consumer and not get any messages to forward.

Some changes may help make this work.
1) only network the current exclusive consumer, at the moment this information 
is lost but could be included in the advisory
2) allow replay if the forwarding consumer is the current exclusive consumer.
3) use 
org.apache.activemq.network.NetworkBridgeConfiguration#setConsumerPriorityBase 
and decreaseNetworkConsumerPriority to ensure that a network or forwarding 
consumer will replace a local consumer.

#3 is the tricky bit, because there will always be a race between competing 
consumers on different brokers. With 3, there is priority to bridging and maybe 
the reverse would be better.
In addition the race is still there between the advisory messages being sent 
and processed. It may need some coordination w.r.t sync dispatch to ensure the 
logic is deterministic.
In all this won't be trivial. 
Because there is no distributed lock on a distributed queue (that is what you 
have, to some extent, with a network), the best we can do is coordinate to pick 
a value and enforce that.

> Exclusive consumer may stop consuming in broker network
> -------------------------------------------------------
>
>                 Key: AMQ-6456
>                 URL: https://issues.apache.org/jira/browse/AMQ-6456
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.1, 5.14.1
>            Reporter: james
>            Priority: Critical
>         Attachments: exclusive_consumer_patch.txt
>
>
> When exclusive consumers are restarted in a network of brokers, the "chosen" 
> consumer may shift from one broker to the next.  In order for existing 
> messages to be consumed, they must be forwarded from the broker on which they 
> currently exist to the broker on which the chosen consumer now resides.  
> However, the ConditionalNetworkBridgeFilter incorrectly decides that it 
> should not forward the messages and they end up getting stuck on the old 
> broker.
> We found the issue in 5.9.1, but the relevant code looks unchanged in the 
> current 5.x release.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to