activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Gies (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AMQ-2109) Proxy Consumers are not closed when a consumer closes on a networked broker
Date Thu, 19 Feb 2009 12:34:00 GMT

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

Andreas Gies commented on AMQ-2109:
-----------------------------------

Analyzing the problem further it seems that the proxy consumer cannot be found once the remote
consumer closes. Though the close event is propagated, it is not processed. 
The following diff addresses the problem. It seems, that the consumer id is being changed
once the proxy consumer is created both for queues and topics. This makes sense
in case of topics and durable subscribers as those must survive when the consumer disconnects.
For queues that does not make sense as a durable subscriber is not needed 
to trigger a desired persistence mechanism. For these reasons the class DurableConduitBridge
has been modified according to the following diff:

++++ Snip 

Index: src/main/java/org/apache/activemq/network/DurableConduitBridge.java
===================================================================
--- src/main/java/org/apache/activemq/network/DurableConduitBridge.java	(revision 745834)
+++ src/main/java/org/apache/activemq/network/DurableConduitBridge.java	(working copy)
@@ -82,17 +82,11 @@
         }
         //add our original id to ourselves
         info.addNetworkConsumerId(info.getConsumerId());
-        // not matched so create a new one
-        // but first, if it's durable - changed set the
-        // ConsumerId here - so it won't be removed if the
-        // durable subscriber goes away on the other end
-        if (info.isDurable() || (info.getDestination().isQueue() && !info.getDestination().isTemporary()))
{  
-            info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator
-                .getNextSequenceId()));
-        }
+
         if (info.isDurable()) {
             // set the subscriber name to something reproducible
-
+            info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), consumerIdGenerator
+                    .getNextSequenceId()));
             info.setSubscriptionName(getSubscriberName(info.getDestination()));
         }
         info.setSelector(null);


++++ snap

This patch didn't break any existing test and also succeeded with the NetworkBrokerDetachTest
provided earlier. 



> Proxy Consumers are not closed when a consumer closes on a networked broker 
> ----------------------------------------------------------------------------
>
>                 Key: AMQ-2109
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2109
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.2.0
>         Environment: This is not related to a specific environment, but could be reproduced
on Linux based machines, Windows machines using  different JDK's.
>            Reporter: Andreas Gies
>            Assignee: Gary Tully
>         Attachments: NetworkBrokerDetachTest.java
>
>
> This error occurs, when we have two brokers BrokerA and BrokerB. The simplest case is
BrokerA being networked to BrokerB with a static network connector. If a consumer is created
on BrokerB for a queue TEST, we will also note a consumer being established on BrokerA for
that Queue, which is the intended behavior. If the consumer is closed on BrokerB, the proxy
consumer on BrokerA continues to exist. Now consider the client reconnects due to failover
reasons to BrokerA this time. BrokerA would then have 2 consumers on TEST, causing a portion
of the messages being consumed by the proxy consumer. 
> So, when a consumer is closed for a queue, the proxy consumers in the peer brokers should
also be closed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message