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.

When processing received remote ConsumerInfo, following code is executed:

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

I think that condition should be changed to:

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

i.e. new ConsumerId should 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 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.

Why should ConsumerId be replaced with new (generated) value, causing
failure of removal of given subscription when RemoveInfo is processed with
original ConsumerId?
-- 
View this message in context: 
http://www.nabble.com/DurableConduitBridge.createDemandSubscription%28%29-for-queues-tp17753931p17753931.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to