Hi there,
I need your precious help again. Scenario: I want to listen to all Advisory
topics, read messages and, at the moment, I need only to print them.
I wrote this code:
private static String ADVISORY_TOPIC = "ActiveMQ.Advisory.>";
public static void main(String[] args) throws Exception {
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://server:port");
ActiveMQConnection connection = (ActiveMQConnection)
connectionFactory.createConnection();
connection.setExceptionListener(new ExceptionListener() {
@Override
public void onException(JMSException jmse) {
System.err.println(jmse);
});
connection.start();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
ActiveMQTopic advisorTopic = (ActiveMQTopic)
session.createTopic(ADVISORY_TOPIC);
MessageConsumer consumer =
session.createConsumer(advisorTopic);
consumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message msg) {
System.out.println(msg);
});
This code works OK with respect to receiving messages: indeed I receive and
display messages from any advisory topic. The problem is that in ActiveMQ
console I do not see any message to be dequeued.
Any hints ? Is that a bug ?
Thanks in advance for your help.
I need your precious help again. Scenario: I want to listen to all Advisory
topics, read messages and, at the moment, I need only to print them.
I wrote this code:
private static String ADVISORY_TOPIC = "ActiveMQ.Advisory.>";
public static void main(String[] args) throws Exception {
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://server:port");
ActiveMQConnection connection = (ActiveMQConnection)
connectionFactory.createConnection();
connection.setExceptionListener(new ExceptionListener() {
@Override
public void onException(JMSException jmse) {
System.err.println(jmse);
});
connection.start();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
ActiveMQTopic advisorTopic = (ActiveMQTopic)
session.createTopic(ADVISORY_TOPIC);
MessageConsumer consumer =
session.createConsumer(advisorTopic);
consumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message msg) {
System.out.println(msg);
});
This code works OK with respect to receiving messages: indeed I receive and
display messages from any advisory topic. The problem is that in ActiveMQ
console I do not see any message to be dequeued.
Any hints ? Is that a bug ?
Thanks in advance for your help.