JMS Topic and durable subscriber help
subendu_sdasgupta Jun 20, 2009 9:56 AMMy flow is
File-Poller --> Bean (Do some validations on the file and send the results to camel) -> Camel --> JMS provider (put the message into a topic)
The JMS provider config is below
<jms:provider service="orderservice:orsjmsprovider"
endpoint="orsProvider"
destinationName="topic/ORS/Order"
replyDestinationName="topic/ORS/Order"
connectionFactory="#connectionFactory"
pubSubDomain="true"
/>
I also have a JMS consumer with target service as JMS producer as shown below
<jms:consumer service="orderservice:orsjmsconsumer"
endpoint="jms"
targetService="orderservice:orsjmsprovider"
targetEndpoint="orsProvider"
destinationName="topic/ORS/Order"
durableSubscriptionName="FirstConsumer"
clientId="LOE-ORS-SubscriberId"
subscriptionDurable="true"
connectionFactory="#connectionFactory" />
I am trying to write a client code to get the message which gets published on the topic, here is the sample code
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL,"tcp://localhost:61616");
ctx = new InitialContext(props);
javax.jms.TopicConnectionFactory factory = (javax.jms.TopicConnectionFactory)ctx.lookup("TopicConnectionFactory");
javax.jms.TopicConnection conn = factory.createTopicConnection();
javax.jms.Topic mytopic = (javax.jms.Topic)ctx.lookup("topic/ORS/Order");
javax.jms.TopicSession session = conn.createTopicSession(false,TopicSession.AUTO_ACKNOWLEDGE);
topicSubscriber = session.createDurableSubscriber(mytopic, clientId);
topicSubscriber.setMessageListener(this);
But i get,
javax.naming.NameNotFoundException: topic/ORS/Order
at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:225)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
What is missing in my configuration?