So I'm just trying to create a JMS message listener in my pivot app that will
listen for messages and populate a table with those messages. My code looks
similar to the code below, does anyone know why this wouldn't work? On my
console for activemq I see the new connection and consumer created when I
launch my application, however when I send messages I never see my println
written.
Pivot 2.0, on Windows. Running in Tomcat with ActiveMQ.
Thanks!
public void startup(Display display, Map<String, String> map) throws
Exception {
System.out.println("Starting...");
...
startMessageListener();
}
public void startMessageListener() {
try {
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory("tcp://1.2.3.4:61616");
connection = factory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
topic = session.createTopic("myTopic");
MessageConsumer consumer = session.createConsumer(topic);
consumer.setMessageListener(new MessageListener {
public void onMessage(Message msg) {
System.out.println("I got a message!!!");
}
});
connection.start();
} catch (Exception e) {
e.printStackTrace();
}
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/JMS-Message-Listener-tp3350099p3350099.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.