Hi,

I'm looking for a way to configure a selector using JNDI. Is it possible?

Here's my definitions inside the context.xml

        <Resource name="jms/ConnectionFactory" auth="Container" 
type="org.apache.activemq.ActiveMQConnectionFactory"
description="ActiveMQ JMS Connection Factory"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="failover://(tcp:YYYYYYYYYY)?randomize=false&amp;trackMessages=true" 
brokerName="JMSBroker"/>

Dev platform
    <Resource name="jms/topicX" auth="Container" 
type="org.apache.activemq.command.ActiveMQTopic" description="Portal
notifications"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
physicalName="portal.notify" messageSelector="platform =
dev"/>

Production

    <Resource name="jms/topicX" auth="Container" 
type="org.apache.activemq.command.ActiveMQTopic" description="Portal
notifications"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
physicalName="portal.notify" messageSelector="platform =
prod"/>


unfortunately this doesn't appear to work with the code....

connection = connFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination dest = (Destination) envContext.lookup("jms/topicX");
MessageConsumer consumer = session.createConsumer(dest);
setupConsumer(consumer);
connection.start();

...

private void setupConsumer(MessageConsumer consumer) throws JMSException {
        consumer.setMessageListener(this);
}

All all messages to the topic are delivered to both production and dev. when 
platform=dev is set in the admin interface
and the message is sent.

Can anyone suggest what I'm doing wrong here?

Alec.

Reply via email to