[KARAF-2511] Complete the jms page in the user guide [KARAF-2549] Fix browsing operation in the JMS MBean
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/04836b61 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/04836b61 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/04836b61 Branch: refs/heads/master Commit: 04836b61efc441d4727ca8188bb973b258ff1f1f Parents: 30c0d56 Author: Jean-Baptiste Onofré <[email protected]> Authored: Thu Dec 19 15:29:16 2013 +0100 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Thu Dec 19 15:29:16 2013 +0100 ---------------------------------------------------------------------- .../apache/karaf/jms/internal/JmsMBeanImpl.java | 2 +- .../karaf/jms/internal/JmsServiceImpl.java | 1 + manual/src/main/webapp/users-guide/jdbc.conf | 4 +- manual/src/main/webapp/users-guide/jms.conf | 58 +++++++++++++++++++- 4 files changed, 61 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/04836b61/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java ---------------------------------------------------------------------- diff --git a/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java index 51de7e7..cc46434 100644 --- a/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java +++ b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsMBeanImpl.java @@ -134,7 +134,7 @@ public class JmsMBeanImpl implements JmsMBean { for (JmsMessage message : getJmsService().browse(connectionFactory, queue, selector, username, password)) { CompositeData data = new CompositeDataSupport(type, new String[]{ "id", "content", "charset", "type", "correlation", "delivery", "destination", "expiration", "priority", "redelivered", "replyto", "timestamp" }, - new Object[]{ message.getMessageId(), message.getContent(), message.getCharset(), message.getType(), message.getCorrelationID(), message.getDeliveryMode(), message.getDestination(), message.getExpiration(), message.getProperties(), message.isRedelivered(), message.getReplyTo(), message.getTimestamp() } + new Object[]{ message.getMessageId(), message.getContent(), message.getCharset(), message.getType(), message.getCorrelationID(), message.getDeliveryMode(), message.getDestination(), message.getExpiration(), message.getPriority(), message.isRedelivered(), message.getReplyTo(), message.getTimestamp() } ); table.put(data); } http://git-wip-us.apache.org/repos/asf/karaf/blob/04836b61/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java ---------------------------------------------------------------------- diff --git a/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java index b39e31a..9be6f6a 100644 --- a/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java +++ b/jms/core/src/main/java/org/apache/karaf/jms/internal/JmsServiceImpl.java @@ -332,6 +332,7 @@ public class JmsServiceImpl implements JmsService { count++; } } while (message != null); + session.commit(); } finally { if (session != null) { session.close(); http://git-wip-us.apache.org/repos/asf/karaf/blob/04836b61/manual/src/main/webapp/users-guide/jdbc.conf ---------------------------------------------------------------------- diff --git a/manual/src/main/webapp/users-guide/jdbc.conf b/manual/src/main/webapp/users-guide/jdbc.conf index abcaead..7950b31 100644 --- a/manual/src/main/webapp/users-guide/jdbc.conf +++ b/manual/src/main/webapp/users-guide/jdbc.conf @@ -186,9 +186,9 @@ REF_GENERATION | TYPE_NAME | TABLE_NAME | TYPE_CAT | REMARKS | TYPE_SCHEM | | PERSON | | | | TABLE | APP | | {code} -h2. JMX JdbcMBean +h2. JMX JDBC MBean -The JMX JdbcMBean provides the JDBC datasources, and the operations to manipulate datasources and database. +The JMX JDBC MBean provides the JDBC datasources, and the operations to manipulate datasources and database. The object name to use is {{org.apache.karaf:type=jdbc,name=*}}. http://git-wip-us.apache.org/repos/asf/karaf/blob/04836b61/manual/src/main/webapp/users-guide/jms.conf ---------------------------------------------------------------------- diff --git a/manual/src/main/webapp/users-guide/jms.conf b/manual/src/main/webapp/users-guide/jms.conf index 5cb460a..c9d6896 100644 --- a/manual/src/main/webapp/users-guide/jms.conf +++ b/manual/src/main/webapp/users-guide/jms.conf @@ -201,6 +201,8 @@ karaf@root()> jms:consume /jms/test MyQueue 2 message(s) consumed {code} +If you want to consume only some messages, you can define a selector using the {{-s}} ({{--selector}}) option. + If the JMS broker requires an authentication, you can use the {{-u}} ({{--username}}) and {{-p}} ({{--password}}) options. {warning} @@ -230,5 +232,59 @@ The {{jms:browse}} command browses a JMS queue and display details about message For instance, to browse the {{MyQueue}} queue: {code} +karaf@root()> jms:browse /jms/test MyQueue +Message ID | Content | Charset | Type | Correlation ID | Delivery Mode | Destination | Expiration | Priority | Redelivered | ReplyTo | Timestamp +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +ID:vostro-59602-1387462183019-3:1:1:1:1 | Hello World | UTF-8 | | | Persistent | queue://MyQueue | Never | 4 | false | | Thu Dec 19 15:10:12 CET 2013 +ID:vostro-59602-1387462183019-3:2:1:1:1 | Hello ActiveMQ | UTF-8 | | | Persistent | queue://MyQueue | Never | 4 | false | | Thu Dec 19 15:10:16 CET 2013 +ID:vostro-59602-1387462183019-3:3:1:1:1 | Hello Karaf | UTF-8 | | | Persistent | queue://MyQueue | Never | 4 | false | | Thu Dec 19 15:10:19 CET 2013 +{code} + +By default, the messages properties are not displayed. You can use the {{-v}} ({{--verbose}}) option to display the properties: + +{code} +karaf@root()> jms:browse -v /jms/test MyQueue +Message ID | Content | Charset | Type | Correlation ID | Delivery Mode | Destination | Expiration | Priority | Redelivered | ReplyTo | Timestamp | Properties +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +ID:vostro-59602-1387462183019-3:1:1:1:1 | Hello World | UTF-8 | | | Persistent | queue://MyQueue | Never | 4 | false | | Thu Dec 19 15:10:12 CET 2013 | +ID:vostro-59602-1387462183019-3:2:1:1:1 | Hello ActiveMQ | UTF-8 | | | Persistent | queue://MyQueue | Never | 4 | false | | Thu Dec 19 15:10:16 CET 2013 | +ID:vostro-59602-1387462183019-3:3:1:1:1 | Hello Karaf | UTF-8 | | | Persistent | queue://MyQueue | Never | 4 | false | | Thu Dec 19 15:10:19 CET 2013 | +{code} + +If you want to browse only some messages, you can define a selector using the {{-s}} ({{--selector}}) option. + +If the JMS broker requires an authentication, you can use the {{-u}} ({{--username}}) and {{-p}} ({{--password}}) options. + +h3. {{jms:move}} + +The {{jms:move}} command consumes all messages from a JMS queue and send it to another one. + +For instance, to move all messages from {{MyQueue}} queue to {{AnotherQueue}} queue, you can do: + +{code} +karaf@root()> jms:move /jms/test MyQueue AnotherQueue +3 message(s) moved +{code} + +h2. JMX JMS MBean + +The JMX JMS MBean provides the attributes and operations to manipulate the JMS connection factories and JMS messages. + +The object name to use is {{org.apache.karaf:type=jms,name=*}}. + +h3. Attributes + +The {{Connectionfactories}} attribute provides the list of all JMS connection factories names. + +h3. Operations -{code} \ No newline at end of file +* {{create(name, type, url)}} creates a JMS connection factory. +* {{delete(name)}} deletes a JMS connection factory. +* {{Map<String, String> info(connectionFactory, username, password)}} gets details about a JMS connection factory and broker. +* {{int count(connectionFactory, queue, username, password)}} counts the number of pending messages on a JMS queue. +* {{List<String> queues(connectionFactory, username, password)}} lists the JMS queues available on the JMS broker. +* {{List<String> topics(connectionFactory, username, password)}} lists the JMS topics available on the JMS broker. +* {{TabularData browse(connectionFactory, queue, selector, username, password)}} browses a JMS queue and provides a table of JMS messages. +* {{send(connectionFactory, queue, content, replyTo, username, password)}} sends a JMS message to a target queue. +* {{int consume(connectionFactory, queue, selector, username, password)}} consumes JMS messages from a JMS queue. +* {{int move(connectionFactory, source, destination, selector, username, password)}} moves messages from a JMS queue to another. \ No newline at end of file
