{"id":30750,"date":"2015-12-23T11:00:56","date_gmt":"2015-12-23T09:00:56","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=30750"},"modified":"2019-03-04T10:33:06","modified_gmt":"2019-03-04T08:33:06","slug":"jms-queuebrowser-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/","title":{"rendered":"JMS QueueBrowser Example"},"content":{"rendered":"<p>A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor the messages without actually consuming them then getting hold of <code>QueueObject<\/code> will allow one to peek ahead at the pending messages.<\/p>\n<p>In this article, we will see an examples of <code>QueueBrowser<\/code> object.<\/p>\n<h2>1. Dependencies<\/h2>\n<p>In order to send and receive JMS messages to and from a JMS message broker, we need to include the message service library. In this example we are using activeMq so our pom.xml will have dependencies related to spring as well as activeMQ.<\/p>\n<p><span style=\"text-decoration: underline\"><em>pom.xml:<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;groupId&gt;com.javacodegeeks.jms&lt;\/groupId&gt;\n\t&lt;artifactId&gt;springJmsQueue&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n\t&lt;dependencies&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;org.apache.activemq&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;activemq-all&lt;\/artifactId&gt;\n\t\t\t&lt;version&gt;5.12.0&lt;\/version&gt;\n\t\t&lt;\/dependency&gt;\n\t&lt;\/dependencies&gt;\n\t\n&lt;\/project&gt;\n<\/pre>\n<\/p>\n<h2>2. Starting the JMS Provider<\/h2>\n<p>JMS is a specification and not an actual product. A JMS provider such as ActiveMQ, IBM, Progress Software, or even Sun provides a messaging product that implements the specification. In our examples, we will be using ActiveMQ as JMS Provider. Getting started with ActiveMQ isn\u2019t difficult. You simply need to start up the broker and make sure that it\u2019s capable of accepting connections and sending messages.<\/p>\n<p>In the below example, the broker is started as a server listening on port 61616. The JMS Clients willing to connect to the broker will be using the TCP protocol (tcp:\/\/localhost:61616). Since the broker and JMS clients are running in the same machine, we have used localhost.<\/p>\n<p><span style=\"text-decoration: underline\"><em>BrokerLauncehr:<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.jms;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport org.apache.activemq.broker.BrokerFactory;\nimport org.apache.activemq.broker.BrokerService;\n\npublic class BrokerLauncher {\n\tpublic static void main(String[] args) throws URISyntaxException, Exception {\n\t\tBrokerService broker = BrokerFactory.createBroker(new URI(\n\t\t\t\t\"broker:(tcp:\/\/localhost:61616)\"));\n\t\tbroker.start();\t\t\n\t}\n}\n<\/pre>\n<p>Output:<\/p>\n<pre class=\"brush:bash\"> INFO | JMX consoles can connect to service:jmx:rmi:\/\/\/jndi\/rmi:\/\/localhost:1099\/jmxrmi\n INFO | PListStore:[C:\\javacodegeeks_ws\\jmsQueueBrowserExample\\activemq-data\\localhost\\tmp_storage] started\n INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\\javacodegeeks_ws\\jmsQueueBrowserExample\\activemq-data\\localhost\\KahaDB]\n INFO | Apache ActiveMQ 5.12.0 (localhost, ID:INMAA1-L1005-57531-1450761099016-0:1) is starting\n INFO | Listening for connections at: tcp:\/\/127.0.0.1:61616\n INFO | Connector tcp:\/\/127.0.0.1:61616 started\n INFO | Apache ActiveMQ 5.12.0 (localhost, ID:INMAA1-L1005-57531-1450761099016-0:1) started\n INFO | For help or more information please see: http:\/\/activemq.apache.org\n WARN | Store limit is 102400 mb (current store usage is 0 mb). The data directory: C:\\javacodegeeks_ws\\jmsQueueBrowserExample\\activemq-data\\localhost\\KahaDB only has 30295 mb of usable space - resetting to maximum available disk space: 30295 mb\n WARN | Temporary Store limit is 51200 mb, whilst the temporary data directory: C:\\javacodegeeks_ws\\jmsQueueBrowserExample\\activemq-data\\localhost\\tmp_storage only has 30295 mb of usable space - resetting to maximum available 30295 mb.\n<\/pre>\n<h2>3. Creating QueueBrowser<\/h2>\n<p>A QueueBrowser can be useful for monitoring the contents of a queue from an administration tool, or for browsing through multiple messages to locate a specific message that one is interested in.<\/p>\n<p>A <code>QueueBrowser<\/code> is created using <code>createBrowser()<\/code> methods in <code>Session<\/code> object. It needs the <code>Queue<\/code> object which needs to be browsed. If one wants to further filter then a message selector can also be passed in.<\/p>\n<p>A message selector holds an expression meant for filtering messages. Only those messages will be delivered whose properties match the message selector expression.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Session:<\/em><\/span><\/p>\n<pre class=\"brush:java\">public interface Session extends Runnable {\n...\n    QueueBrowser createBrowser(Queue queue) throws JMSException;\n\n    QueueBrowser createBrowser(Queue queue, String messageSelector)\n        throws JMSException;\n...\n}\n<\/pre>\n<pre class=\"brush:java\">QueueBrowser browser = session.createBrowser(queue);\n<\/pre>\n<h2>4. QueueBrowser API<\/h2>\n<p>A queue browser implements the <code>QueueBrowser<\/code> interface.<\/p>\n<p><span style=\"text-decoration: underline\"><em>QueueBrowser:<\/em><\/span><\/p>\n<pre class=\"brush:java\">public interface QueueBrowser {\n    Queue getQueue() throws JMSException;\n    String getMessageSelector() throws JMSException;\n    Enumeration getEnumeration() throws JMSException;\n    void close() throws JMSException;\n}\n<\/pre>\n<ol>\n<li><code>getQueue()<\/code> &#8211; returns the queue that needs to be browsed<\/li>\n<li><code>getMessageSelector()<\/code> &#8211; returns the message selector expression that is used to filter the messages in queue.<\/li>\n<li><code>getEnumeration()<\/code> returns the enumeration object that will be used to iterate through the queue<\/li>\n<li><code>close()<\/code> &#8211; close method should be<br \/>\ncalled whenever a browser is no longer needed to free any resources that the JMS provider may<br \/>\nhave allocated on behalf of this browser.<\/li>\n<\/ol>\n<h2>5. QueueBrowser Example<\/h2>\n<p>In order to browse the messages, we need to call <code>createQueueBrowser( )<\/code> on <code>Session<\/code> object. We passed in the <code>Queue<\/code> object that needs to be browsed.<\/p>\n<p>The <code>QueueBrowser<\/code> object contains a <code>java.util.Enumeration<\/code> which is used to iterate through the queue.<\/p>\n<p>We will send some message to the queue and then create a queue browser object to enumerate through the messages. Next,&nbsp;we will close the queue browser object. Finally, we will receive all the messages from the queue.<\/p>\n<p><span style=\"text-decoration: underline\"><em>JmsQueueBrowseExample:<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.jms;\n\nimport java.net.URISyntaxException;\nimport java.util.Enumeration;\n\nimport javax.jms.Connection;\nimport javax.jms.ConnectionFactory;\nimport javax.jms.Message;\nimport javax.jms.MessageConsumer;\nimport javax.jms.MessageProducer;\nimport javax.jms.Queue;\nimport javax.jms.QueueBrowser;\nimport javax.jms.Session;\nimport javax.jms.TextMessage;\n\nimport org.apache.activemq.ActiveMQConnectionFactory;\n\npublic class JmsQueueBrowseExample {\n\tpublic static void main(String[] args) throws URISyntaxException, Exception {\n\t\tConnection connection = null;\n\t\ttry {\n\t\t\t\/\/ Producer\n\t\t\tConnectionFactory connectionFactory = new ActiveMQConnectionFactory(\n\t\t\t\t\t\"tcp:\/\/localhost:61616\");\n\t\t\tconnection = connectionFactory.createConnection();\n\t\t\tSession session = connection.createSession(false,\n\t\t\t\t\tSession.AUTO_ACKNOWLEDGE);\n\t\t\tQueue queue = session.createQueue(\"browseQueue\");\n\t\t\tMessageProducer producer = session.createProducer(queue);\n\t\t\tString task = \"Task\";\n\t\t\tfor (int i = 0; i &lt; 10; i++) {\n\t\t\t\tString payload = task + i;\n\t\t\t\tMessage msg = session.createTextMessage(payload);\n\t\t\t\tSystem.out.println(\"Sending text '\" + payload + \"'\");\n\t\t\t\tproducer.send(msg);\n\t\t\t}\n\n\t\t\tMessageConsumer consumer = session.createConsumer(queue);\n\t\t\tconnection.start();\n\n\t\t\tSystem.out.println(\"Browse through the elements in queue\");\n\t\t\tQueueBrowser browser = session.createBrowser(queue);\n\t\t\tEnumeration e = browser.getEnumeration();\n\t\t\twhile (e.hasMoreElements()) {\n\t\t\t\tTextMessage message = (TextMessage) e.nextElement();\n\t\t\t\tSystem.out.println(\"Browse [\" + message.getText() + \"]\");\n\t\t\t}\n\t\t\tSystem.out.println(\"Done\");\n\t\t\tbrowser.close();\n\n\t\t\tfor (int i = 0; i &lt; 10; i++) {\n\t\t\t\tTextMessage textMsg = (TextMessage) consumer.receive();\n\t\t\t\tSystem.out.println(textMsg);\n\t\t\t\tSystem.out.println(\"Received: \" + textMsg.getText());\n\t\t\t}\n\t\t\tsession.close();\n\t\t} finally {\n\t\t\tif (connection != null) {\n\t\t\t\tconnection.close();\n\t\t\t}\n\t\t}\n\t}\n\n}\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>Output:<\/em><\/span><\/p>\n<pre class=\"brush:bash; highlight:[11,12,13,14,15,16,17,18,19,20,21,22]\">Sending text 'Task0'\nSending text 'Task1'\nSending text 'Task2'\nSending text 'Task3'\nSending text 'Task4'\nSending text 'Task5'\nSending text 'Task6'\nSending text 'Task7'\nSending text 'Task8'\nSending text 'Task9'\nBrowse through the elements in queue\nBrowse [Task0]\nBrowse [Task1]\nBrowse [Task2]\nBrowse [Task3]\nBrowse [Task4]\nBrowse [Task5]\nBrowse [Task6]\nBrowse [Task7]\nBrowse [Task8]\nBrowse [Task9]\nDone\nActiveMQTextMessage {commandId = 5, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226017, arrival = 0, brokerInTime = 1450762226018, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@6b71769e, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task0}\nReceived: Task0\nActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:2, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226025, arrival = 0, brokerInTime = 1450762226025, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@2752f6e2, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task1}\nReceived: Task1\nActiveMQTextMessage {commandId = 7, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:3, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226027, arrival = 0, brokerInTime = 1450762226028, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@e580929, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task2}\nReceived: Task2\nActiveMQTextMessage {commandId = 8, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:4, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226030, arrival = 0, brokerInTime = 1450762226030, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@1cd072a9, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task3}\nReceived: Task3\nActiveMQTextMessage {commandId = 9, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:5, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226033, arrival = 0, brokerInTime = 1450762226033, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@7c75222b, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task4}\nReceived: Task4\nActiveMQTextMessage {commandId = 10, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:6, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226036, arrival = 0, brokerInTime = 1450762226036, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@4c203ea1, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task5}\nReceived: Task5\nActiveMQTextMessage {commandId = 11, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:7, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226039, arrival = 0, brokerInTime = 1450762226039, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@27f674d, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task6}\nReceived: Task6\nActiveMQTextMessage {commandId = 12, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:8, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226042, arrival = 0, brokerInTime = 1450762226042, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@1d251891, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task7}\nReceived: Task7\nActiveMQTextMessage {commandId = 13, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:9, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226045, arrival = 0, brokerInTime = 1450762226045, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@48140564, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task8}\nReceived: Task8\nActiveMQTextMessage {commandId = 14, responseRequired = true, messageId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1:10, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-58661-1450762225866-1:1:1:1, destination = queue:\/\/browseQueue, transactionId = null, expiration = 0, timestamp = 1450762226047, arrival = 0, brokerInTime = 1450762226047, brokerOutTime = 1450762226054, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@58ceff1, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task9}\nReceived: Task9\n<\/pre>\n<h2>6. QueueBrowser Example with Message Selector<\/h2>\n<p>In this example we will see the overloaded version of <code>createQueueBrowser()<\/code> method that takes in <code>Queue<\/code> as well as <code>messageSelector<\/code>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>A message selector holds an expression meant for filtering messages. Only those messages will be delivered whose properties match the message selector expression.<\/p>\n<p>For example sake, we will set &#8216;sequence&#8217; property to &#8216;even&#8217; for the even sequenced messages.<\/p>\n<pre class=\"brush:java\">for (int i = 0; i &lt; 10; i++) {\n\t\t\t\tString payload = task + i;\n\t\t\t\tMessage msg = session.createTextMessage(payload);\n\t\t\t\tSystem.out.println(\"Sending text '\" + payload + \"'\");\n\t\t\t\tif (i % 2 == 0) {\n\t\t\t\t\tmsg.setStringProperty(\"sequence\", \"even\");\n\t\t\t\t}\n\t\t\t\tproducer.send(msg);\n\t\t\t}\n<\/pre>\n<p>Suppose we only want to browse the even sequenced messages then the message selector would be <code>\"sequence = 'even'\"<\/code>.[ulp id=&#8217;meNHaG2axN7AsWAw&#8217;]<\/p>\n<p>We will create <code>QueueBrowser<\/code> using this message selector.<\/p>\n<pre class=\"brush:java\">QueueBrowser browser = session.createBrowser(queue,\n\t\t\t\t\t\"sequence = 'even'\");\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>JmsBrowseQueueMessageSelectorExample:<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.jms;\n\nimport java.net.URISyntaxException;\nimport java.util.Enumeration;\n\nimport javax.jms.Connection;\nimport javax.jms.ConnectionFactory;\nimport javax.jms.Message;\nimport javax.jms.MessageConsumer;\nimport javax.jms.MessageProducer;\nimport javax.jms.Queue;\nimport javax.jms.QueueBrowser;\nimport javax.jms.Session;\nimport javax.jms.TextMessage;\n\nimport org.apache.activemq.ActiveMQConnectionFactory;\n\npublic class JmsQueueBrowserWithMessageSelectorExample {\n\tpublic static void main(String[] args) throws URISyntaxException, Exception {\n\t\tConnection connection = null;\n\t\ttry {\n\t\t\t\/\/ Producer\n\t\t\tConnectionFactory connectionFactory = new ActiveMQConnectionFactory(\n\t\t\t\t\t\"tcp:\/\/localhost:61616\");\n\t\t\tconnection = connectionFactory.createConnection();\n\t\t\tSession session = connection.createSession(false,\n\t\t\t\t\tSession.AUTO_ACKNOWLEDGE);\n\t\t\tQueue queue = session.createQueue(\"customerQueue\");\n\n\t\t\tMessageProducer producer = session.createProducer(queue);\n\t\t\tString task = \"Task\";\n\t\t\tfor (int i = 0; i &lt; 10; i++) {\n\t\t\t\tString payload = task + i;\n\t\t\t\tMessage msg = session.createTextMessage(payload);\n\t\t\t\tSystem.out.println(\"Sending text '\" + payload + \"'\");\n\t\t\t\tif (i % 2 == 0) {\n\t\t\t\t\tmsg.setStringProperty(\"sequence\", \"even\");\n\t\t\t\t}\n\t\t\t\tproducer.send(msg);\n\t\t\t}\n\n\t\t\tMessageConsumer consumer = session.createConsumer(queue);\n\t\t\tconnection.start();\n\n\t\t\tSystem.out.println(\"Browse through the elements in queue\");\n\t\t\tQueueBrowser browser = session.createBrowser(queue,\n\t\t\t\t\t\"sequence = 'even'\");\n\t\t\tEnumeration e = browser.getEnumeration();\n\t\t\twhile (e.hasMoreElements()) {\n\t\t\t\tTextMessage message = (TextMessage) e.nextElement();\n\t\t\t\tSystem.out.println(\"Browse [\" + message.getText() + \"]\");\n\t\t\t}\n\t\t\tSystem.out.println(\"Done\");\n\t\t\tbrowser.close();\n\n\t\t\tfor (int i = 0; i &lt; 10; i++) {\n\t\t\t\tTextMessage textMsg = (TextMessage) consumer.receive();\n\t\t\t\tSystem.out.println(textMsg);\n\t\t\t\tSystem.out.println(\"Received: \" + textMsg.getText());\n\t\t\t}\n\t\t\tsession.close();\n\t\t} finally {\n\t\t\tif (connection != null) {\n\t\t\t\tconnection.close();\n\t\t\t}\n\t\t}\n\t}\n\n}\n<\/pre>\n<p>A you can see only the even sequenced messages show up in the enumeration object.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Output:<\/em><\/span><\/p>\n<pre class=\"brush:bash; highlight:[11,12,13,14,15,16,17]\">Sending text 'Task0'\nSending text 'Task1'\nSending text 'Task2'\nSending text 'Task3'\nSending text 'Task4'\nSending text 'Task5'\nSending text 'Task6'\nSending text 'Task7'\nSending text 'Task8'\nSending text 'Task9'\nBrowse through the elements in queue\nBrowse [Task0]\nBrowse [Task2]\nBrowse [Task4]\nBrowse [Task6]\nBrowse [Task8]\nDone\nActiveMQTextMessage {commandId = 7, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:3, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421106, arrival = 0, brokerInTime = 1450761421106, brokerOutTime = 1450761525026, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@5ebec15, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task2}\nReceived: Task2\nActiveMQTextMessage {commandId = 8, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:4, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421109, arrival = 0, brokerInTime = 1450761421109, brokerOutTime = 1450761525026, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@21bcffb5, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task3}\nReceived: Task3\nActiveMQTextMessage {commandId = 9, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:5, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421111, arrival = 0, brokerInTime = 1450761421112, brokerOutTime = 1450761525027, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@380fb434, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task4}\nReceived: Task4\nActiveMQTextMessage {commandId = 10, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:6, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421114, arrival = 0, brokerInTime = 1450761421114, brokerOutTime = 1450761525027, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@668bc3d5, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task5}\nReceived: Task5\nActiveMQTextMessage {commandId = 11, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:7, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421117, arrival = 0, brokerInTime = 1450761421117, brokerOutTime = 1450761525027, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@3cda1055, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task6}\nReceived: Task6\nActiveMQTextMessage {commandId = 12, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:8, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421120, arrival = 0, brokerInTime = 1450761421120, brokerOutTime = 1450761525028, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@7a5d012c, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task7}\nReceived: Task7\nActiveMQTextMessage {commandId = 13, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:9, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421123, arrival = 0, brokerInTime = 1450761421123, brokerOutTime = 1450761525028, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@3fb6a447, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task8}\nReceived: Task8\nActiveMQTextMessage {commandId = 14, responseRequired = true, messageId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1:10, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57862-1450761420954-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761421126, arrival = 0, brokerInTime = 1450761421126, brokerOutTime = 1450761525028, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@79b4d0f, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task9}\nReceived: Task9\nActiveMQTextMessage {commandId = 5, responseRequired = true, messageId = ID:INMAA1-L1005-57943-1450761507228-1:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57943-1450761507228-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761507375, arrival = 0, brokerInTime = 1450761507376, brokerOutTime = 1450761525028, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@5f2050f6, marshalledProperties = org.apache.activemq.util.ByteSequence@3b81a1bc, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {sequence=even}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task0}\nReceived: Task0\nActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:INMAA1-L1005-57943-1450761507228-1:1:1:1:2, originalDestination = null, originalTransactionId = null, producerId = ID:INMAA1-L1005-57943-1450761507228-1:1:1:1, destination = queue:\/\/customerQueue, transactionId = null, expiration = 0, timestamp = 1450761507380, arrival = 0, brokerInTime = 1450761507380, brokerOutTime = 1450761525028, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@64616ca2, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false, text = Task1}\nReceived: Task1\n<\/pre>\n<h2>7. Download the Eclipse Project<\/h2>\n<p>This was an example about JMS QueueBrowser object.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/jmsQueueBrowserExample.zip\"><strong>jmsQueueBrowserExample.zip<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor the messages without actually consuming them then getting hold of QueueObject will allow one to peek ahead at the pending messages. In this article, we will see an examples of QueueBrowser object. &hellip;<\/p>\n","protected":false},"author":38,"featured_media":1240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-30750","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jms"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JMS QueueBrowser Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JMS QueueBrowser Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-23T09:00:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-04T08:33:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ram Mokkapaty\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ram Mokkapaty\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\"},\"author\":{\"name\":\"Ram Mokkapaty\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7b1823eb5bd673bd375f8bee33b70cd8\"},\"headline\":\"JMS QueueBrowser Example\",\"datePublished\":\"2015-12-23T09:00:56+00:00\",\"dateModified\":\"2019-03-04T08:33:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\"},\"wordCount\":596,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"articleSection\":[\"jms\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\",\"name\":\"JMS QueueBrowser Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"datePublished\":\"2015-12-23T09:00:56+00:00\",\"dateModified\":\"2019-03-04T08:33:06+00:00\",\"description\":\"A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jms\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jms\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JMS QueueBrowser Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7b1823eb5bd673bd375f8bee33b70cd8\",\"name\":\"Ram Mokkapaty\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/Ram-Mokkapaty-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/Ram-Mokkapaty-96x96.jpg\",\"caption\":\"Ram Mokkapaty\"},\"description\":\"Ram holds a master's degree in Machine Design from IT B.H.U. His expertise lies in test driven development and re-factoring. He is passionate about open source technologies and actively blogs on various java and open-source technologies like spring. He works as a principal Engineer in the logistics domain.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/in.linkedin.com\/pub\/ram-satish-mokkapaty\/18\/123\/52b\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/ram-mokkapaty\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JMS QueueBrowser Example - Java Code Geeks","description":"A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/","og_locale":"en_US","og_type":"article","og_title":"JMS QueueBrowser Example - Java Code Geeks","og_description":"A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-12-23T09:00:56+00:00","article_modified_time":"2019-03-04T08:33:06+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Ram Mokkapaty","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ram Mokkapaty","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/"},"author":{"name":"Ram Mokkapaty","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7b1823eb5bd673bd375f8bee33b70cd8"},"headline":"JMS QueueBrowser Example","datePublished":"2015-12-23T09:00:56+00:00","dateModified":"2019-03-04T08:33:06+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/"},"wordCount":596,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","articleSection":["jms"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/","name":"JMS QueueBrowser Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","datePublished":"2015-12-23T09:00:56+00:00","dateModified":"2019-03-04T08:33:06+00:00","description":"A point-to-point messaging queue contains messages to be consumed by clients interested in the specific destination queue. If one wants to simply monitor","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/enterprise-java-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/jms\/jms-queuebrowser-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"jms","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/jms\/"},{"@type":"ListItem","position":5,"name":"JMS QueueBrowser Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7b1823eb5bd673bd375f8bee33b70cd8","name":"Ram Mokkapaty","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/Ram-Mokkapaty-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/12\/Ram-Mokkapaty-96x96.jpg","caption":"Ram Mokkapaty"},"description":"Ram holds a master's degree in Machine Design from IT B.H.U. His expertise lies in test driven development and re-factoring. He is passionate about open source technologies and actively blogs on various java and open-source technologies like spring. He works as a principal Engineer in the logistics domain.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/in.linkedin.com\/pub\/ram-satish-mokkapaty\/18\/123\/52b"],"url":"https:\/\/examples.javacodegeeks.com\/author\/ram-mokkapaty\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/30750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=30750"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/30750\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1240"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=30750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=30750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=30750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}