{"id":6142,"date":"2017-01-20T09:02:22","date_gmt":"2017-01-20T14:02:22","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=6142"},"modified":"2017-01-20T09:02:22","modified_gmt":"2017-01-20T14:02:22","slug":"listing-queues-and-topics-in-activemq","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2017\/01\/20\/listing-queues-and-topics-in-activemq\/","title":{"rendered":"Listing queues and topics in ActiveMQ"},"content":{"rendered":"<p>This will provide the list of queues and topics managed by an ActiveMQ broker&#8230;<\/p>\n<pre>\r\nimport javax.jms.*;\r\nimport java.io.*;\r\nimport java.util.*;\r\nimport org.apache.activemq.*;\r\nimport org.apache.activemq.command.*;\r\nimport org.apache.activemq.advisory.*;\r\n\r\npublic class GetDestinations {\r\n  private static String url = ActiveMQConnection.DEFAULT_BROKER_URL;\r\n  public static void main(String[] args) throws Exception {\r\n    ActiveMQConnectionFactory connectionFactory=new ActiveMQConnectionFactory(\"admin\", \"password\", \r\n                                                                              \"failover:(tcp:\/\/esb01:61616,tcp:\/\/esb02:61616)\");\r\n    ActiveMQConnection connection = (ActiveMQConnection)connectionFactory.createConnection();\r\n    Session session = connection.createSession(true,  Session.AUTO_ACKNOWLEDGE);\r\n    connection.start();\r\n    DestinationSource dest = connection.getDestinationSource();\r\n    Set<ActiveMQTopic> amqt = dest.getTopics();\r\n    System.out.println(amqt);\r\n    Iterator<ActiveMQTopic> queues2 = amqt.iterator();\r\n    while (queues2.hasNext()) {\r\n      ActiveMQTopic queue3 = queues2.next();\r\n      System.out.println(new Date() + \"\\t\" + \"Topic: \" + queue3.getPhysicalName());\r\n    }\r\n    Set<ActiveMQQueue> amqs = dest.getQueues();\r\n    System.out.println(amqs);\r\n    Iterator<ActiveMQQueue> queues = amqs.iterator();\r\n    while (queues.hasNext()) {\r\n      ActiveMQQueue queue2 = queues.next();\r\n      System.out.println(\"Queue: \" + queue2.getPhysicalName());\r\n    }\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This will provide the list of queues and topics managed by an ActiveMQ broker&#8230; import javax.jms.*; import java.io.*; import java.util.*; import org.apache.activemq.*; import org.apache.activemq.command.*; import org.apache.activemq.advisory.*; public class GetDestinations { private static String url = ActiveMQConnection.DEFAULT_BROKER_URL; public static void main(String[]&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2017\/01\/20\/listing-queues-and-topics-in-activemq\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[71,69],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6142"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=6142"}],"version-history":[{"count":5,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6142\/revisions"}],"predecessor-version":[{"id":6147,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/6142\/revisions\/6147"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=6142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=6142"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=6142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}