You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ram chowdary <vr...@infinera.com> on 2006/09/08 09:32:22 UTC

Changing Message Selector fails

Hi,


   I have two brokers B1 and B2. Producer P1 connected to B1 and B2 added to
B1 as network connector. As per my requirement I will be changing the
selector dynamically. The following code is written to change the selector
for Consumer.

    public void changeMessageSelector(String filter)
    {
        if( filter != null )
            try
            {
                if (consumer != null)
                {
                    MessageConsumer consumerNew =
session.createConsumer(topic, filter);
                    consumerNew.setMessageListener(this);
                    consumer.close();
                    consumer = consumerNew;                   
                    if (LogClient.isFinerAllowed)
                    {
                        _logger.finer("Message Selector Changed to
"+filter);
                    }
                }
            }
            catch (JMSException e)
            {
                _logger.log(Level.SEVERE, "Failed to change Message
Selector, Exception", e);
            }
        else
        {
            _logger.severe("NULL Message Selector is passed");
        }
    }

  Consumber C1 connected to broker B1 then everything is working I am able
to change the selector dynamically and getting all the message published by
P1.
 But if Consumer C2 connected to B2 then when ever I try to change the
selector I am getting the following error message and broker stop reporting
new messages.

2006-09-05 19:13:28,829 | DEBUG | ActiveMQ Transport:
tcp:///10.10.10.36:36005 | DemandForwardingBridge:386 | Ignoring sub
ConsumerInfo {commandId = 4, responseRequired = true, consumerId =
ID:L3-BFNE3-2973-1157464184513-0:0:1:1, destination = topic://AVC,
prefetchSize = 32766, maximumPendingMessageLimit = 0, browser = false,
dispatchAsync = false, selector = (MD1=TRUE OR MD2=TRUE OR MD3=TRUE OR
MD4=TRUE) AND (MoTypeNum = 501 ), subcriptionName = null, noLocal = false,
exclusive = false, retroactive = false, priority = 0, brokerPath =
[ID:SWNM-BLADE-36-35165-1157463491647-0:0], optimizedAcknowledge = false,
noRangeAcks = false, additionalPredicate = null} already subscribed to
matching destination

2006-09-05 19:13:46,761 | DEBUG | ActiveMQ Transport:
tcp:///10.10.10.36:36005 | ConduitBridge:87 | removing sub on
vm://CFEBroker#0 from 10.10.10.361271177757251298667 :  ConsumerInfo
{commandId = 4, responseRequired = true, consumerId =
ID:L3-BFNE3-2972-1157464183045-0:0:1:1, destination = topic://AVC,
prefetchSize = 32766, maximumPendingMessageLimit = 0, browser = false,
dispatchAsync = false, selector = (MD1=TRUE OR MD2=TRUE OR MD3=TRUE OR
MD4=TRUE) AND (MoTypeNum = 501 ), subcriptionName = null, noLocal = false,
exclusive = false, retroactive = false, priority = 0, brokerPath =
[ID:SWNM-BLADE-36-35165-1157463491647-0:0], optimizedAcknowledge = false,
noRangeAcks = false, additionalPredicate = null}

Thanks
 Ram


-- 
View this message in context: http://www.nabble.com/Changing-Message-Selector-fails-tf2237506.html#a6204232
Sent from the ActiveMQ - User forum at Nabble.com.