I am using the ActiveMQ "Classic" StatisticsPlugin to collect stats for destinations. I have used ActiveMQ.Statistics.Destination.*
along with a replyTo
header to collect the stats for all the topics. Unfortunately it's not working. It works if I use a named destination, but it's not working if i use wildcard.
Connection connection = activeMQConnectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue replyTo = session.createTemporaryQueue();
MessageConsumer consumer = session.createConsumer(replyTo);
MessageProducer producer = session.createProducer(null);
//
String topicName = "ActiveMQ.Statistics.Destination.*";
Topic query = session.createTopic(topicName);
Message msg = session.createMessage();
msg.setJMSReplyTo(replyTo);
producer.send(query, msg);
System.out.println("Message sent to wildcard topics.");
MapMessage reply = (MapMessage) consumer.receive();
// assertNotNull(reply);
System.out.println("test");
for (Enumeration e = reply.getMapNames(); e.hasMoreElements();) {
String name = e.nextElement().toString();
System.out.println(name + "=" + reply.getObject(name));
}
connection.close();
Could you please help me?