DurableConduitBridge: DemandSubscription for queue not removed when processing 
RemoveInfo
-----------------------------------------------------------------------------------------

                 Key: AMQ-1822
                 URL: https://issues.apache.org/activemq/browse/AMQ-1822
             Project: ActiveMQ
          Issue Type: Bug
          Components: Connector
    Affects Versions: 5.2.0
            Reporter: Mario Lukica
            Priority: Minor


I have the following problem when using network of brokers connected via 
DurableConduitBridge: 
- when consumer on (non temporary) queue is created on node1, 
DemandSubscription is created on node2 (e.g. NC_node1-broker_inboundlocalhost; 
this is expected) 
- problem: when this consumer is closed, subscription is not removed 

This causes following behaviour: 
- when there are no consumers on given queue on any broker, messages are always 
forwarded via NetworkConnector to other broker, if there was consumer at any 
point in time (since DemandSubscription is never removed) 

I think the problem lies in DurableConduitBridge, createDemandSubscription 
method. 

This behavior can be validated by using jconsole (via jmx) and checking 
subscriptions on given queue on both brokers, depending on consumer existence 
on given queue on any broker.

Described behaviour exists in: 4.1.0, 4.1.1, 4.1.2, 5.0.0 and 5.1.0 and 5.2 
trunk (670451).

When processing received remote ConsumerInfo, following code is executed: 

{code}
        if (info.isDurable() || (info.getDestination().isQueue() && 
!info.getDestination().isTemporary())) {  
            info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), 
consumerIdGenerator
                .getNextSequenceId()));
        }
{code}

Replacing ConsumerId with new (generated) value, causes failure of removal of 
given subscription when RemoveInfo is processed with original ConsumerId.

I think that condition should be changed to: 

{code}
        if (info.isDurable() || (info.getDestination().isQueue() && 
info.getDestination().isTemporary())) {  
            info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(), 
consumerIdGenerator
                .getNextSequenceId()));
        }
{code}

i.e. new ConsumerId should probably be created for temporary queues, and not 
regular ones. With this condition changed, DemandSubscription is successfully 
removed when consumer is closed on queue on other broker. 

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

Reply via email to