Hi,
I am trying to subscribe to a JMS topic within a custom MBean.
I'm trying to do this in the postRegister method and my code is pretty basic and looks something like this:
ConnectionFactory factory = (ConnectionFactory)initialContext.lookup(
"... some JNDI name ...");
Connection connection = factory.createConnection();
Session session = connection.createSession(true,
Session.AUTO_ACKNOWLEDGE);
Destination dest = (Destination)initialContext.lookup(
"... some JNDI name ...");
Consumer consumer = session.createConsumer(dest);
consumer.setMessageListener(this);
connection.start();
I seem to have all the components in place but when a message is sent by a publisher on the topic the listener onMessage(...) method receives nothing. I know the topic is receiving something because I have a seperate MDB listening in and it is receiving it fine.
Am I just doing something wrong or is there some issue with MBeans directly subscribing as consumers to JMS?
Thanks for any help!!
[Message sent by forum member 'bkatnich' (bkatnich)]
http://forums.java.net/jive/thread.jspa?messageID=209786