http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ClusterConnectionControl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ClusterConnectionControl.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ClusterConnectionControl.java
new file mode 100644
index 0000000..a735978
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ClusterConnectionControl.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import java.util.Map;
+
+/**
+ * A ClusterConnectionControl is used to manage a cluster connection.
+ *
+ * @author <a href="[email protected]">Jeff Mesnil</a>
+ *
+ */
+public interface ClusterConnectionControl extends HornetQComponentControl
+{
+   /**
+    * Returns the configuration name of this cluster connection.
+    */
+   String getName();
+
+   /**
+    * Returns the address used by this cluster connection.
+    */
+   String getAddress();
+
+   /**
+    * Returns the node ID used by this cluster connection.
+    */
+   String getNodeID();
+
+   /**
+    * Return whether this cluster connection use duplicate detection.
+    */
+   boolean isDuplicateDetection();
+
+   /**
+    * Return whether this cluster connection forward messages when it has no 
local consumers.
+    */
+   boolean isForwardWhenNoConsumers();
+
+   /**
+    * Return the Topology that this Cluster Connection knows about
+    */
+   String getTopology();
+   /**
+    * Returns the maximum number of hops used by this cluster connection.
+    */
+   int getMaxHops();
+
+   /**
+    * Returns the list of static connectors
+    */
+   Object[] getStaticConnectors();
+
+   /**
+    * Returns the list of static connectors as JSON
+    */
+   String getStaticConnectorsAsJSON() throws Exception;
+
+   /**
+    * Returns the name of the discovery group used by this cluster connection.
+    */
+   String getDiscoveryGroupName();
+
+   /**
+    * Returns the connection retry interval used by this cluster connection.
+    */
+   long getRetryInterval();
+
+   /**
+    * Returns a map of the nodes connected to this cluster connection.
+    * <br>
+    * keys are node IDs, values are the addresses used to connect to the nodes.
+    */
+   Map<String, String> getNodes() throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/CoreNotificationType.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/CoreNotificationType.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/CoreNotificationType.java
new file mode 100644
index 0000000..03d807b
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/CoreNotificationType.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+/**
+ * This enum defines all core notification types
+ *
+ * @author <a href="mailto:[email protected]";>Howard Gao</a>
+ */
+public enum CoreNotificationType implements NotificationType
+{
+   BINDING_ADDED(0),
+   BINDING_REMOVED(1),
+   CONSUMER_CREATED(2),
+   CONSUMER_CLOSED(3),
+   SECURITY_AUTHENTICATION_VIOLATION(6),
+   SECURITY_PERMISSION_VIOLATION(7),
+   DISCOVERY_GROUP_STARTED(8),
+   DISCOVERY_GROUP_STOPPED(9),
+   BROADCAST_GROUP_STARTED(10),
+   BROADCAST_GROUP_STOPPED(11),
+   BRIDGE_STARTED(12),
+   BRIDGE_STOPPED(13),
+   CLUSTER_CONNECTION_STARTED(14),
+   CLUSTER_CONNECTION_STOPPED(15),
+   ACCEPTOR_STARTED(16),
+   ACCEPTOR_STOPPED(17),
+   PROPOSAL(18),
+   PROPOSAL_RESPONSE(19),
+   UNPROPOSAL(20),
+   CONSUMER_SLOW(21);
+
+   private final int value;
+
+   private CoreNotificationType(final int value)
+   {
+      this.value = value;
+   }
+
+   public int getType()
+   {
+      return value;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DayCounterInfo.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DayCounterInfo.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DayCounterInfo.java
new file mode 100644
index 0000000..0b1f1d4
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DayCounterInfo.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import java.util.Arrays;
+
+import org.apache.activemq6.utils.json.JSONArray;
+import org.apache.activemq6.utils.json.JSONException;
+import org.apache.activemq6.utils.json.JSONObject;
+
+/**
+ * Helper class to create Java Objects from the
+ * JSON serialization returned by {@link 
QueueControl#listMessageCounterHistory()}.
+ *
+ *  @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public final class DayCounterInfo
+{
+
+   private final String date;
+
+   private final int[] counters;
+
+   // Static --------------------------------------------------------
+
+   public static String toJSON(final DayCounterInfo[] infos) throws 
JSONException
+   {
+      JSONObject json = new JSONObject();
+      JSONArray counters = new JSONArray();
+      for (DayCounterInfo info : infos)
+      {
+         JSONObject counter = new JSONObject();
+         counter.put("date", info.getDate());
+         counter.put("counters", Arrays.asList(info.getCounters()));
+         counters.put(counter);
+      }
+      json.put("dayCounters", counters);
+      return json.toString();
+   }
+
+   /**
+    * Returns an array of RoleInfo corresponding to the JSON serialization 
returned
+    * by {@link QueueControl#listMessageCounterHistory()}.
+    */
+   public static DayCounterInfo[] fromJSON(final String jsonString) throws 
JSONException
+   {
+      JSONObject json = new JSONObject(jsonString);
+      JSONArray dayCounters = json.getJSONArray("dayCounters");
+      DayCounterInfo[] infos = new DayCounterInfo[dayCounters.length()];
+      for (int i = 0; i < dayCounters.length(); i++)
+      {
+
+         JSONObject counter = (JSONObject)dayCounters.get(i);
+         JSONArray hour = (JSONArray)counter.getJSONArray("counters").get(0);
+         int[] hourCounters = new int[24];
+         for (int j = 0; j < 24; j++)
+         {
+            hourCounters[j] = hour.getInt(j);
+         }
+         DayCounterInfo info = new DayCounterInfo(counter.getString("date"), 
hourCounters);
+         infos[i] = info;
+      }
+      return infos;
+   }
+
+   // Constructors --------------------------------------------------
+
+   public DayCounterInfo(final String date, final int[] counters)
+   {
+      this.date = date;
+      this.counters = counters;
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Returns the date of the counter.
+    */
+   public String getDate()
+   {
+      return date;
+   }
+
+   /**
+    * Returns a 24-length array corresponding to the number of messages added 
to the queue
+    * for the given hour of the day.
+    */
+   public int[] getCounters()
+   {
+      return counters;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DivertControl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DivertControl.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DivertControl.java
new file mode 100644
index 0000000..b3a9e10
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/DivertControl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+/**
+ * A DivertControl is used to manage a divert.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public interface DivertControl
+{
+   /**
+    * Returns the filter used by this divert.
+    */
+   String getFilter();
+
+   /**
+    * Returns whether this divert is exclusive.
+    * <br>
+    * if {@code true} messages will be exclusively diverted and will not be 
routed to the origin address,
+    * else messages will be routed both to the origin address and the 
forwarding address.
+    */
+   boolean isExclusive();
+
+   /**
+    * Returns the cluster-wide unique name of this divert.
+    */
+   String getUniqueName();
+
+   /**
+    * Returns the routing name of this divert.
+    */
+   String getRoutingName();
+
+   /**
+    * Returns the origin address used by this divert.
+    */
+   String getAddress();
+
+   /**
+    * Returns the forwarding address used by this divert.
+    */
+   String getForwardingAddress();
+
+   /**
+    * Return the name of the 
org.apache.activemq6.core.server.cluster.Transformer implementation associated 
to this bridge.
+    */
+   String getTransformerClassName();
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQComponentControl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQComponentControl.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQComponentControl.java
new file mode 100644
index 0000000..00f773f
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQComponentControl.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+/**
+ * A HornetQComponentControl is used to manage the life cycle of a HornetQ 
component.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public interface HornetQComponentControl
+{
+   /**
+    * Returns {@code true} if this component is started, {@code false} else.
+    */
+   boolean isStarted();
+
+   /**
+    * Starts this component.
+    */
+   void start() throws Exception;
+
+   /**
+    * Stops this component.
+    */
+   void stop() throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQServerControl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQServerControl.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQServerControl.java
new file mode 100644
index 0000000..052d332
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/HornetQServerControl.java
@@ -0,0 +1,621 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import javax.management.MBeanOperationInfo;
+
+/**
+ * A HornetQServerControl is used to manage HornetQ servers.
+ */
+public interface HornetQServerControl
+{
+   /**
+    * Returns this server's version.
+    */
+   String getVersion();
+
+   /**
+    * Returns the number of connections connected to this server.
+    */
+   int getConnectionCount();
+
+   /**
+    * Return whether this server is started.
+    */
+   boolean isStarted();
+
+   /**
+    * Returns the list of interceptors used by this server. Invoking this 
method is the same as invoking
+    * <code>getIncomingInterceptorClassNames().</code>
+    *
+    * @see org.apache.activemq6.api.core.Interceptor
+    * @deprecated As of HornetQ 2.3.0.Final, replaced by
+    * {@link #getIncomingInterceptorClassNames()} and
+    * {@link #getOutgoingInterceptorClassNames()}
+    */
+   @Deprecated
+   String[] getInterceptorClassNames();
+
+   /**
+    * Returns the list of interceptors used by this server for incoming 
messages.
+    *
+    * @see org.apache.activemq6.api.core.Interceptor
+    */
+   String[] getIncomingInterceptorClassNames();
+
+   /**
+    * Returns the list of interceptors used by this server for outgoing 
messages.
+    *
+    * @see org.apache.activemq6.api.core.Interceptor
+    */
+   String[] getOutgoingInterceptorClassNames();
+
+   /**
+    * Returns whether this server is clustered.
+    */
+   boolean isClustered();
+
+   /**
+    * Returns the maximum number of threads in the <em>scheduled</em> thread 
pool.
+    */
+   int getScheduledThreadPoolMaxSize();
+
+   /**
+    * Returns the maximum number of threads in the thread pool.
+    */
+   int getThreadPoolMaxSize();
+
+   /**
+    * Returns the interval time (in milliseconds) to invalidate security 
credentials.
+    */
+   long getSecurityInvalidationInterval();
+
+   /**
+    * Returns whether security is enabled for this server.
+    */
+   boolean isSecurityEnabled();
+
+   /**
+    * Returns the file system directory used to store bindings.
+    */
+   String getBindingsDirectory();
+
+   /**
+    * Returns the file system directory used to store journal log.
+    */
+   String getJournalDirectory();
+
+   /**
+    * Returns the type of journal used by this server (either {@code NIO} or 
{@code ASYNCIO}).
+    */
+   String getJournalType();
+
+   /**
+    * Returns whether the journal is synchronized when receiving transactional 
data.
+    */
+   boolean isJournalSyncTransactional();
+
+   /**
+    * Returns whether the journal is synchronized when receiving 
non-transactional data.
+    */
+   boolean isJournalSyncNonTransactional();
+
+   /**
+    * Returns the size (in bytes) of each journal files.
+    */
+   int getJournalFileSize();
+
+   /**
+    * Returns the number of journal files to pre-create.
+    */
+   int getJournalMinFiles();
+
+   /**
+    * Returns the maximum number of write requests that can be in the AIO 
queue at any given time.
+    */
+   int getJournalMaxIO();
+
+   /**
+    * Returns the size of the internal buffer on the journal.
+    */
+   int getJournalBufferSize();
+
+   /**
+    * Returns the timeout (in nanoseconds) used to flush internal buffers on 
the journal.
+    */
+   int getJournalBufferTimeout();
+
+   /**
+    * do any clients failover on a server shutdown
+    */
+   void setFailoverOnServerShutdown(boolean failoverOnServerShutdown) throws 
Exception;
+
+
+   /**
+    * returns if clients failover on a server shutdown
+    */
+   boolean isFailoverOnServerShutdown();
+
+   /**
+    * Returns the minimal number of journal files before compacting.
+    */
+   int getJournalCompactMinFiles();
+
+   /**
+    * Return the percentage of live data before compacting the journal.
+    */
+   int getJournalCompactPercentage();
+
+   /**
+    * Returns whether this server is using persistence and store data.
+    */
+   boolean isPersistenceEnabled();
+
+   /**
+    * Returns whether the bindings directory is created on this server startup.
+    */
+   boolean isCreateBindingsDir();
+
+   /**
+    * Returns whether the journal directory is created on this server startup.
+    */
+   boolean isCreateJournalDir();
+
+   /**
+    * Returns whether message counter is enabled for this server.
+    */
+   boolean isMessageCounterEnabled();
+
+   /**
+    * Returns the maximum number of days kept in memory for message counter.
+    */
+   int getMessageCounterMaxDayCount();
+
+   /**
+    * Sets the maximum number of days kept in memory for message counter.
+    *
+    * @param count value must be greater than 0
+    */
+   void setMessageCounterMaxDayCount(int count) throws Exception;
+
+   /**
+    * Returns the sample period (in milliseconds) to take message counter 
snapshot.
+    */
+   long getMessageCounterSamplePeriod();
+
+   /**
+    * Sets the sample period to take message counter snapshot.
+    *
+    * @param newPeriod value must be greater than 1000ms
+    */
+   void setMessageCounterSamplePeriod(long newPeriod) throws Exception;
+
+   /**
+    * Returns {@code true} if this server is a backup, {@code false} if it is 
a live server.
+    * <br>
+    * If a backup server has been activated, returns {@code false}.
+    */
+   boolean isBackup();
+
+   /**
+    * Returns whether this server shares its data store with a corresponding 
live or backup server.
+    */
+   boolean isSharedStore();
+
+   /**
+    * Returns the file system directory used to store paging files.
+    */
+   String getPagingDirectory();
+
+   /**
+    * Returns whether delivery count is persisted before messages are 
delivered to the consumers.
+    */
+   boolean isPersistDeliveryCountBeforeDelivery();
+
+   /**
+    * Returns the connection time to live.
+    * <br>
+    * This value overrides the connection time to live <em>sent by the 
client</em>.
+    */
+   long getConnectionTTLOverride();
+
+   /**
+    * Returns the management address of this server.
+    * <br>
+    * Clients can send management messages to this address to manage this 
server.
+    */
+   String getManagementAddress();
+
+   /**
+    * Returns the management notification address of this server.
+    * <br>
+    * Clients can bind queues to this address to receive management 
notifications emitted by this server.
+    */
+   String getManagementNotificationAddress();
+
+   /**
+    * Returns the size of the cache for pre-creating message IDs.
+    */
+   int getIDCacheSize();
+
+   /**
+    * Returns whether message ID cache is persisted.
+    */
+   boolean isPersistIDCache();
+
+   /**
+    * Returns the file system directory used to store large messages.
+    */
+   String getLargeMessagesDirectory();
+
+   /**
+    * Returns whether wildcard routing is supported by this server.
+    */
+   boolean isWildcardRoutingEnabled();
+
+   /**
+    * Returns the timeout (in milliseconds) after which transactions is removed
+    * from the resource manager after it was created.
+    */
+   long getTransactionTimeout();
+
+   /**
+    * Returns the frequency (in milliseconds)  to scan transactions to detect 
which transactions
+    * have timed out.
+    */
+   long getTransactionTimeoutScanPeriod();
+
+   /**
+    * Returns the frequency (in milliseconds)  to scan messages to detect 
which messages
+    * have expired.
+    */
+   long getMessageExpiryScanPeriod();
+
+   /**
+    * Returns the priority of the thread used to scan message expiration.
+    */
+   long getMessageExpiryThreadPriority();
+
+   /**
+    * Returns whether code coming from connection is executed asynchronously 
or not.
+    */
+   boolean isAsyncConnectionExecutionEnabled();
+
+   /**
+    * Returns the connectors configured for this server.
+    */
+   Object[] getConnectors() throws Exception;
+
+   /**
+    * Returns the connectors configured for this server using JSON 
serialization.
+    */
+   String getConnectorsAsJSON() throws Exception;
+
+   /**
+    * Returns the addresses created on this server.
+    */
+   String[] getAddressNames();
+
+   /**
+    * Returns the names of the queues created on this server.
+    */
+   String[] getQueueNames();
+
+   // Operations ----------------------------------------------------
+
+   /**
+    * Create a durable queue.
+    * <br>
+    * This method throws a {@link 
org.apache.activemq6.api.core.HornetQQueueExistsException}) exception if the 
queue already exits.
+    *
+    * @param address address to bind the queue to
+    * @param name    name of the queue
+    */
+   @Operation(desc = "Create a queue with the specified address", impact = 
MBeanOperationInfo.ACTION)
+   void createQueue(@Parameter(name = "address", desc = "Address of the 
queue") String address,
+                    @Parameter(name = "name", desc = "Name of the queue") 
String name) throws Exception;
+
+   /**
+    * Create a queue.
+    * <br>
+    * This method throws a {@link 
org.apache.activemq6.api.core.HornetQQueueExistsException}) exception if the 
queue already exits.
+    *
+    * @param address address to bind the queue to
+    * @param name    name of the queue
+    * @param filter  of the queue
+    * @param durable whether the queue is durable
+    */
+   @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION)
+   void createQueue(@Parameter(name = "address", desc = "Address of the 
queue") String address,
+                    @Parameter(name = "name", desc = "Name of the queue") 
String name,
+                    @Parameter(name = "filter", desc = "Filter of the queue") 
String filter,
+                    @Parameter(name = "durable", desc = "Is the queue 
durable?") boolean durable) throws Exception;
+
+   /**
+    * Create a queue.
+    * <br>
+    * This method throws a {@link 
org.apache.activemq6.api.core.HornetQQueueExistsException}) exception if the 
queue already exits.
+    *
+    * @param address address to bind the queue to
+    * @param name    name of the queue
+    * @param durable whether the queue is durable
+    */
+   @Operation(desc = "Create a queue with the specified address, name and 
durability", impact = MBeanOperationInfo.ACTION)
+   void createQueue(@Parameter(name = "address", desc = "Address of the 
queue") String address,
+                    @Parameter(name = "name", desc = "Name of the queue") 
String name,
+                    @Parameter(name = "durable", desc = "Is the queue 
durable?") boolean durable) throws Exception;
+
+   /**
+    * Deploy a durable queue.
+    * <br>
+    * This method will do nothing if the queue with the given name already 
exists on the server.
+    *
+    * @param address address to bind the queue to
+    * @param name    name of the queue
+    * @param filter  of the queue
+    */
+   @Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION)
+   void deployQueue(@Parameter(name = "address", desc = "Address of the 
queue") String address,
+                    @Parameter(name = "name", desc = "Name of the queue") 
String name,
+                    @Parameter(name = "filter", desc = "Filter of the queue") 
String filter) throws Exception;
+
+   /**
+    * Deploy a queue.
+    * <br>
+    * This method will do nothing if the queue with the given name already 
exists on the server.
+    *
+    * @param address address to bind the queue to
+    * @param name    name of the queue
+    * @param filter  of the queue
+    * @param durable whether the queue is durable
+    */
+   @Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION)
+   void deployQueue(@Parameter(name = "address", desc = "Address of the 
queue") String address,
+                    @Parameter(name = "name", desc = "Name of the queue") 
String name,
+                    @Parameter(name = "filter", desc = "Filter of the queue") 
String filter,
+                    @Parameter(name = "durable", desc = "Is the queue 
durable?") boolean durable) throws Exception;
+
+   /**
+    * Destroys the queue corresponding to the specified name.
+    */
+   @Operation(desc = "Destroy a queue", impact = MBeanOperationInfo.ACTION)
+   void destroyQueue(@Parameter(name = "name", desc = "Name of the queue to 
destroy") String name) throws Exception;
+
+   /**
+    * Enables message counters for this server.
+    */
+   @Operation(desc = "Enable message counters", impact = 
MBeanOperationInfo.ACTION)
+   void enableMessageCounters() throws Exception;
+
+   /**
+    * Disables message counters for this server.
+    */
+   @Operation(desc = "Disable message counters", impact = 
MBeanOperationInfo.ACTION)
+   void disableMessageCounters() throws Exception;
+
+   /**
+    * Reset all message counters.
+    */
+   @Operation(desc = "Reset all message counters", impact = 
MBeanOperationInfo.ACTION)
+   void resetAllMessageCounters() throws Exception;
+
+   /**
+    * Reset histories for all message counters.
+    */
+   @Operation(desc = "Reset all message counters history", impact = 
MBeanOperationInfo.ACTION)
+   void resetAllMessageCounterHistories() throws Exception;
+
+   /**
+    * List all the prepared transaction, sorted by date, oldest first.
+    * <br>
+    * The Strings are Base-64 representation of the transaction XID and can be
+    * used to heuristically commit or rollback the transactions.
+    *
+    * @see #commitPreparedTransaction(String)
+    * @see #rollbackPreparedTransaction(String)
+    */
+   @Operation(desc = "List all the prepared transaction, sorted by date, 
oldest first")
+   String[] listPreparedTransactions() throws Exception;
+
+   /**
+    * List all the prepared transaction, sorted by date,
+    * oldest first, with details, in text format.
+    */
+   @Operation(desc = "List all the prepared transaction, sorted by date, 
oldest first, with details, in JSON format")
+   String listPreparedTransactionDetailsAsJSON() throws Exception;
+
+   /**
+    * List all the prepared transaction, sorted by date,
+    * oldest first, with details, in HTML format
+    */
+   @Operation(desc = "List all the prepared transaction, sorted by date, 
oldest first, with details, in HTML format")
+   String listPreparedTransactionDetailsAsHTML() throws Exception;
+
+   /**
+    * List transactions which have been heuristically committed.
+    */
+   String[] listHeuristicCommittedTransactions() throws Exception;
+
+   /**
+    * List transactions which have been heuristically rolled back.
+    */
+   String[] listHeuristicRolledBackTransactions() throws Exception;
+
+   /**
+    * Heuristically commits a prepared transaction.
+    *
+    * @param transactionAsBase64 base 64 representation of a prepare 
transaction
+    * @return {@code true} if the transaction was successfully committed, 
{@code false} else
+    * @see #listPreparedTransactions()
+    */
+   @Operation(desc = "Commit a prepared transaction")
+   boolean commitPreparedTransaction(@Parameter(desc = "the Base64 
representation of a transaction", name = "transactionAsBase64") String 
transactionAsBase64) throws Exception;
+
+   /**
+    * Heuristically rolls back a prepared transaction.
+    *
+    * @param transactionAsBase64 base 64 representation of a prepare 
transaction
+    * @return {@code true} if the transaction was successfully rolled back, 
{@code false} else
+    * @see #listPreparedTransactions()
+    */
+   @Operation(desc = "Rollback a prepared transaction")
+   boolean rollbackPreparedTransaction(@Parameter(desc = "the Base64 
representation of a transaction", name = "transactionAsBase64") String 
transactionAsBase64) throws Exception;
+
+   /**
+    * Lists the addresses of all the clients connected to this address.
+    */
+   @Operation(desc = "List the client addresses", impact = 
MBeanOperationInfo.INFO)
+   String[] listRemoteAddresses() throws Exception;
+
+   /**
+    * Lists the addresses of the clients connected to this address which 
matches the specified IP address.
+    */
+   @Operation(desc = "List the client addresses which match the given IP 
Address", impact = MBeanOperationInfo.INFO)
+   String[] listRemoteAddresses(@Parameter(desc = "an IP address", name = 
"ipAddress") String ipAddress) throws Exception;
+
+   /**
+    * Closes all the connections of clients connected to this server which 
matches the specified IP address.
+    */
+   @Operation(desc = "Closes all the connections for the given IP Address", 
impact = MBeanOperationInfo.INFO)
+   boolean closeConnectionsForAddress(@Parameter(desc = "an IP address", name 
= "ipAddress") String ipAddress) throws Exception;
+
+   /**
+    * Closes all the connections of clients connected to this server which 
matches the specified IP address.
+    */
+   @Operation(desc = "Closes all the consumer connections for the given 
HornetQ address", impact = MBeanOperationInfo.INFO)
+   boolean closeConsumerConnectionsForAddress(@Parameter(desc = "a HornetQ 
address", name = "address") String address) throws Exception;
+
+   /**
+    * Closes all the connections of sessions with a matching user name.
+    */
+   @Operation(desc = "Closes all the connections for sessions with the given 
user name", impact = MBeanOperationInfo.INFO)
+   boolean closeConnectionsForUser(@Parameter(desc = "a user name", name = 
"userName") String address) throws Exception;
+
+   /**
+    * Lists all the IDs of the connections connected to this server.
+    */
+   @Operation(desc = "List all the connection IDs", impact = 
MBeanOperationInfo.INFO)
+   String[] listConnectionIDs() throws Exception;
+
+   String listProducersInfoAsJSON() throws Exception;
+
+   /**
+    * Lists all the sessions IDs for the specified connection ID.
+    */
+   @Operation(desc = "List the sessions for the given connectionID", impact = 
MBeanOperationInfo.INFO)
+   String[] listSessions(@Parameter(desc = "a connection ID", name = 
"connectionID") String connectionID) throws Exception;
+
+   /**
+    * This method is used by HornetQ clustering and must not be called by 
HornetQ clients.
+    */
+   void sendQueueInfoToQueue(String queueName, String address) throws 
Exception;
+
+   @Operation(desc = "Add security settings for addresses matching the 
addressMatch", impact = MBeanOperationInfo.ACTION)
+   void addSecuritySettings(
+      @Parameter(desc = "an address match", name = "addressMatch") String 
addressMatch,
+      @Parameter(desc = "a comma-separated list of roles allowed to send 
messages", name = "send") String sendRoles,
+      @Parameter(desc = "a comma-separated list of roles allowed to consume 
messages", name = "consume") String consumeRoles,
+      @Parameter(desc = "a comma-separated list of roles allowed to create 
durable queues", name = "createDurableQueueRoles") String 
createDurableQueueRoles,
+      @Parameter(desc = "a comma-separated list of roles allowed to delete 
durable queues", name = "deleteDurableQueueRoles") String 
deleteDurableQueueRoles,
+      @Parameter(desc = "a comma-separated list of roles allowed to create non 
durable queues", name = "createNonDurableQueueRoles") String 
createNonDurableQueueRoles,
+      @Parameter(desc = "a comma-separated list of roles allowed to delete non 
durable queues", name = "deleteNonDurableQueueRoles") String 
deleteNonDurableQueueRoles,
+      @Parameter(desc = "a comma-separated list of roles allowed to send 
management messages messages", name = "manage") String manageRoles) throws 
Exception;
+
+   @Operation(desc = "Remove security settings for an address", impact = 
MBeanOperationInfo.ACTION)
+   void removeSecuritySettings(@Parameter(desc = "an address match", name = 
"addressMatch") String addressMatch) throws Exception;
+
+   @Operation(desc = "get roles for a specific address match", impact = 
MBeanOperationInfo.INFO)
+   Object[] getRoles(@Parameter(desc = "an address match", name = 
"addressMatch") String addressMatch) throws Exception;
+
+   @Operation(desc = "get roles (as a JSON string) for a specific address 
match", impact = MBeanOperationInfo.INFO)
+   String getRolesAsJSON(@Parameter(desc = "an address match", name = 
"addressMatch") String addressMatch) throws Exception;
+
+   /**
+    * adds a new address setting for a specific address
+    */
+   @Operation(desc = "Add address settings for addresses matching the 
addressMatch", impact = MBeanOperationInfo.ACTION)
+   void addAddressSettings(@Parameter(desc = "an address match", name = 
"addressMatch") String addressMatch,
+                           @Parameter(desc = "the dead letter address 
setting", name = "DLA") String DLA,
+                           @Parameter(desc = "the expiry address setting", 
name = "expiryAddress") String expiryAddress,
+                           @Parameter(desc = "the expiry delay setting", name 
= "expiryDelay") long expiryDelay,
+                           @Parameter(desc = "are any queues created for this 
address a last value queue", name = "lastValueQueue") boolean lastValueQueue,
+                           @Parameter(desc = "the delivery attempts", name = 
"deliveryAttempts") int deliveryAttempts,
+                           @Parameter(desc = "the max size in bytes", name = 
"maxSizeBytes") long maxSizeBytes,
+                           @Parameter(desc = "the page size in bytes", name = 
"pageSizeBytes") int pageSizeBytes,
+                           @Parameter(desc = "the max number of pages in the 
soft memory cache", name = "pageMaxCacheSize") int pageMaxCacheSize,
+                           @Parameter(desc = "the redelivery delay", name = 
"redeliveryDelay") long redeliveryDelay,
+                           @Parameter(desc = "the redelivery delay 
multiplier", name = "redeliveryMultiplier") double redeliveryMultiplier,
+                           @Parameter(desc = "the maximum redelivery delay", 
name = "maxRedeliveryDelay") long maxRedeliveryDelay,
+                           @Parameter(desc = "the redistribution delay", name 
= "redistributionDelay") long redistributionDelay,
+                           @Parameter(desc = "do we send to the DLA when there 
is no where to route the message", name = "sendToDLAOnNoRoute") boolean 
sendToDLAOnNoRoute,
+                           @Parameter(desc = "the policy to use when the 
address is full", name = "addressFullMessagePolicy") String 
addressFullMessagePolicy,
+                           @Parameter(desc = "when a consumer falls below this 
threshold in terms of messages consumed per second it will be considered 
'slow'", name = "slowConsumerThreshold") long slowConsumerThreshold,
+                           @Parameter(desc = "how often (in seconds) to check 
for slow consumers", name = "slowConsumerCheckPeriod") long 
slowConsumerCheckPeriod,
+                           @Parameter(desc = "the policy to use when a slow 
consumer is detected", name = "slowConsumerPolicy") String slowConsumerPolicy) 
throws Exception;
+
+   void removeAddressSettings(String addressMatch) throws Exception;
+
+   /**
+    * returns the address settings as a JSON string
+    */
+   @Operation(desc = "returns the address settings as a JSON string for an 
address match", impact = MBeanOperationInfo.INFO)
+   String getAddressSettingsAsJSON(@Parameter(desc = "an address match", name 
= "addressMatch") String addressMatch) throws Exception;
+
+   String[] getDivertNames();
+
+   @Operation(desc = "Create a Divert", impact = MBeanOperationInfo.ACTION)
+   void createDivert(@Parameter(name = "name", desc = "Name of the divert") 
String name,
+                     @Parameter(name = "routingName", desc = "Routing name of 
the divert") String routingName,
+                     @Parameter(name = "address", desc = "Address to divert 
from") String address,
+                     @Parameter(name = "forwardingAddress", desc = "Address to 
divert to") String forwardingAddress,
+                     @Parameter(name = "exclusive", desc = "Is the divert 
exclusive?") boolean exclusive,
+                     @Parameter(name = "filterString", desc = "Filter of the 
divert") String filterString,
+                     @Parameter(name = "transformerClassName", desc = "Class 
name of the divert's transformer") String transformerClassName) throws 
Exception;
+
+   @Operation(desc = "Destroy a Divert", impact = MBeanOperationInfo.ACTION)
+   void destroyDivert(@Parameter(name = "name", desc = "Name of the divert") 
String name) throws Exception;
+
+   String[] getBridgeNames();
+
+   @Operation(desc = "Create a Bridge", impact = MBeanOperationInfo.ACTION)
+   void createBridge(@Parameter(name = "name", desc = "Name of the bridge") 
String name,
+                     @Parameter(name = "queueName", desc = "Name of the source 
queue") String queueName,
+                     @Parameter(name = "forwardingAddress", desc = "Forwarding 
address") String forwardingAddress,
+                     @Parameter(name = "filterString", desc = "Filter of the 
brdige") String filterString,
+                     @Parameter(name = "transformerClassName", desc = "Class 
name of the bridge transformer") String transformerClassName,
+                     @Parameter(name = "retryInterval", desc = "Connection 
retry interval") long retryInterval,
+                     @Parameter(name = "retryIntervalMultiplier", desc = 
"Connection retry interval multiplier") double retryIntervalMultiplier,
+                     @Parameter(name = "initialConnectAttempts", desc = 
"Number of initial connection attempts") int initialConnectAttempts,
+                     @Parameter(name = "reconnectAttempts", desc = "Number of 
reconnection attempts") int reconnectAttempts,
+                     @Parameter(name = "useDuplicateDetection", desc = "Use 
duplicate detection") boolean useDuplicateDetection,
+                     @Parameter(name = "confirmationWindowSize", desc = 
"Confirmation window size") int confirmationWindowSize,
+                     @Parameter(name = "clientFailureCheckPeriod", desc = 
"Period to check client failure") long clientFailureCheckPeriod,
+                     @Parameter(name = "staticConnectorNames", desc = "comma 
separated list of connector names or name of discovery group if 
'useDiscoveryGroup' is set to true") String connectorNames,
+                     @Parameter(name = "useDiscoveryGroup", desc = "use 
discovery  group") boolean useDiscoveryGroup,
+                     @Parameter(name = "ha", desc = "Is it using HA") boolean 
ha,
+                     @Parameter(name = "user", desc = "User name") String user,
+                     @Parameter(name = "password", desc = "User password") 
String password) throws Exception;
+
+
+   @Operation(desc = "Destroy a bridge", impact = MBeanOperationInfo.ACTION)
+   void destroyBridge(@Parameter(name = "name", desc = "Name of the bridge") 
String name) throws Exception;
+
+   @Operation(desc = "force the server to stop and notify clients to 
failover", impact = MBeanOperationInfo.UNKNOWN)
+   void forceFailover() throws Exception;
+
+   void updateDuplicateIdCache(String address, Object[] ids) throws Exception;
+
+   @Operation(desc = "force the server to stop and to scale down to another 
server", impact = MBeanOperationInfo.UNKNOWN)
+   void scaleDown(@Parameter(name = "name", desc = "The connector to use to 
scale down, if not provided the first appropriate connector will be 
used")String connector) throws Exception;
+}
+

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ManagementHelper.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ManagementHelper.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ManagementHelper.java
new file mode 100644
index 0000000..b0e980e
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ManagementHelper.java
@@ -0,0 +1,459 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.activemq6.api.core.Message;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.core.client.HornetQClientMessageBundle;
+import org.apache.activemq6.utils.json.JSONArray;
+import org.apache.activemq6.utils.json.JSONObject;
+
+/**
+ * Helper class to use HornetQ Core messages to manage server resources.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public final class ManagementHelper
+{
+   // Constants -----------------------------------------------------
+
+   public static final SimpleString HDR_RESOURCE_NAME = new 
SimpleString("_HQ_ResourceName");
+
+   public static final SimpleString HDR_ATTRIBUTE = new 
SimpleString("_HQ_Attribute");
+
+   public static final SimpleString HDR_OPERATION_NAME = new 
SimpleString("_HQ_OperationName");
+
+   public static final SimpleString HDR_OPERATION_SUCCEEDED = new 
SimpleString("_HQ_OperationSucceeded");
+
+   public static final SimpleString HDR_NOTIFICATION_TYPE = new 
SimpleString("_HQ_NotifType");
+
+   public static final SimpleString HDR_NOTIFICATION_TIMESTAMP = new 
SimpleString("_HQ_NotifTimestamp");
+
+   public static final SimpleString HDR_ROUTING_NAME = new 
SimpleString("_HQ_RoutingName");
+
+   public static final SimpleString HDR_CLUSTER_NAME = new 
SimpleString("_HQ_ClusterName");
+
+   public static final SimpleString HDR_ADDRESS = new 
SimpleString("_HQ_Address");
+
+   public static final SimpleString HDR_BINDING_ID = new 
SimpleString("_HQ_Binding_ID");
+
+   public static final SimpleString HDR_BINDING_TYPE = new 
SimpleString("_HQ_Binding_Type");
+
+   public static final SimpleString HDR_FILTERSTRING = new 
SimpleString("_HQ_FilterString");
+
+   public static final SimpleString HDR_DISTANCE = new 
SimpleString("_HQ_Distance");
+
+   public static final SimpleString HDR_CONSUMER_COUNT = new 
SimpleString("_HQ_ConsumerCount");
+
+   public static final SimpleString HDR_USER = new SimpleString("_HQ_User");
+
+   public static final SimpleString HDR_CHECK_TYPE = new 
SimpleString("_HQ_CheckType");
+
+   public static final SimpleString HDR_SESSION_NAME = new 
SimpleString("_HQ_SessionName");
+
+   public static final SimpleString HDR_REMOTE_ADDRESS = new 
SimpleString("_HQ_RemoteAddress");
+
+   public static final SimpleString HDR_PROPOSAL_GROUP_ID = new 
SimpleString("_JBM_ProposalGroupId");
+
+   public static final SimpleString HDR_PROPOSAL_VALUE = new 
SimpleString("_JBM_ProposalValue");
+
+   public static final SimpleString HDR_PROPOSAL_ALT_VALUE = new 
SimpleString("_JBM_ProposalAltValue");
+
+   public static final SimpleString HDR_CONSUMER_NAME = new 
SimpleString("_HQ_ConsumerName");
+
+   public static final SimpleString HDR_CONNECTION_NAME = new 
SimpleString("_HQ_ConnectionName");
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   /**
+    * Stores a resource attribute in a message to retrieve the value from the 
server resource.
+    *
+    * @param message      message
+    * @param resourceName the name of the resource
+    * @param attribute    the name of the attribute
+    * @see ResourceNames
+    */
+   public static void putAttribute(final Message message, final String 
resourceName, final String attribute)
+   {
+      message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, new 
SimpleString(resourceName));
+      message.putStringProperty(ManagementHelper.HDR_ATTRIBUTE, new 
SimpleString(attribute));
+   }
+
+   /**
+    * Stores a operation invocation in a message to invoke the corresponding 
operation the value from the server resource.
+    *
+    * @param message       message
+    * @param resourceName  the name of the resource
+    * @param operationName the name of the operation to invoke on the resource
+    * @see ResourceNames
+    */
+   public static void putOperationInvocation(final Message message,
+                                             final String resourceName,
+                                             final String operationName) 
throws Exception
+   {
+      ManagementHelper.putOperationInvocation(message, resourceName, 
operationName, (Object[]) null);
+   }
+
+   /**
+    * Stores a operation invocation in a  message to invoke the corresponding 
operation the value from the server resource.
+    *
+    * @param message       message
+    * @param resourceName  the name of the server resource
+    * @param operationName the name of the operation to invoke on the server 
resource
+    * @param parameters    the parameters to use to invoke the server resource
+    * @see ResourceNames
+    */
+   public static void putOperationInvocation(final Message message,
+                                             final String resourceName,
+                                             final String operationName,
+                                             final Object... parameters) 
throws Exception
+   {
+      // store the name of the operation in the headers
+      message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, new 
SimpleString(resourceName));
+      message.putStringProperty(ManagementHelper.HDR_OPERATION_NAME, new 
SimpleString(operationName));
+
+      // and the params go in the body, since might be too large for header
+
+      String paramString;
+
+      if (parameters != null)
+      {
+         JSONArray jsonArray = ManagementHelper.toJSONArray(parameters);
+
+         paramString = jsonArray.toString();
+      }
+      else
+      {
+         paramString = null;
+      }
+
+      
message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(paramString));
+   }
+
+   private static JSONArray toJSONArray(final Object[] array) throws Exception
+   {
+      JSONArray jsonArray = new JSONArray();
+
+      for (Object parameter : array)
+      {
+         if (parameter instanceof Map)
+         {
+            Map<String, Object> map = (Map<String, Object>) parameter;
+
+            JSONObject jsonObject = new JSONObject();
+
+            for (Map.Entry<String, Object> entry : map.entrySet())
+            {
+               String key = entry.getKey();
+
+               Object val = entry.getValue();
+
+               if (val != null)
+               {
+                  if (val.getClass().isArray())
+                  {
+                     val = ManagementHelper.toJSONArray((Object[]) val);
+                  }
+                  else
+                  {
+                     ManagementHelper.checkType(val);
+                  }
+               }
+
+               jsonObject.put(key, val);
+            }
+
+            jsonArray.put(jsonObject);
+         }
+         else
+         {
+            if (parameter != null)
+            {
+               Class<?> clz = parameter.getClass();
+
+               if (clz.isArray())
+               {
+                  Object[] innerArray = (Object[]) parameter;
+
+                  jsonArray.put(ManagementHelper.toJSONArray(innerArray));
+               }
+               else
+               {
+                  ManagementHelper.checkType(parameter);
+
+                  jsonArray.put(parameter);
+               }
+            }
+            else
+            {
+               jsonArray.put((Object) null);
+            }
+         }
+      }
+
+      return jsonArray;
+   }
+
+   private static Object[] fromJSONArray(final JSONArray jsonArray) throws 
Exception
+   {
+      Object[] array = new Object[jsonArray.length()];
+
+      for (int i = 0; i < jsonArray.length(); i++)
+      {
+         Object val = jsonArray.get(i);
+
+         if (val instanceof JSONArray)
+         {
+            Object[] inner = ManagementHelper.fromJSONArray((JSONArray) val);
+
+            array[i] = inner;
+         }
+         else if (val instanceof JSONObject)
+         {
+            JSONObject jsonObject = (JSONObject) val;
+
+            Map<String, Object> map = new HashMap<String, Object>();
+
+            Iterator<String> iter = jsonObject.keys();
+
+            while (iter.hasNext())
+            {
+               String key = iter.next();
+
+               Object innerVal = jsonObject.get(key);
+
+               if (innerVal instanceof JSONArray)
+               {
+                  innerVal = ManagementHelper.fromJSONArray(((JSONArray) 
innerVal));
+               }
+               else if (innerVal instanceof JSONObject)
+               {
+                  Map<String, Object> innerMap = new HashMap<String, Object>();
+                  JSONObject o = (JSONObject) innerVal;
+                  Iterator it = o.keys();
+                  while (it.hasNext())
+                  {
+                     String k = (String) it.next();
+                     innerMap.put(k, o.get(k));
+                  }
+                  innerVal = innerMap;
+               }
+               else if (innerVal instanceof Integer)
+               {
+                  innerVal = ((Integer) innerVal).longValue();
+               }
+
+               map.put(key, innerVal);
+            }
+
+            array[i] = map;
+         }
+         else
+         {
+            if (val == JSONObject.NULL)
+            {
+               array[i] = null;
+            }
+            else
+            {
+               array[i] = val;
+            }
+         }
+      }
+
+      return array;
+   }
+
+   private static void checkType(final Object param)
+   {
+      if (param instanceof Integer == false && param instanceof Long == false 
&&
+         param instanceof Double == false &&
+         param instanceof String == false &&
+         param instanceof Boolean == false &&
+         param instanceof Map == false &&
+         param instanceof Byte == false &&
+         param instanceof Short == false)
+      {
+         throw 
HornetQClientMessageBundle.BUNDLE.invalidManagementParam(param.getClass().getName());
+      }
+   }
+
+   /**
+    * Used by HornetQ management service.
+    */
+   public static Object[] retrieveOperationParameters(final Message message) 
throws Exception
+   {
+      SimpleString sstring = 
message.getBodyBuffer().readNullableSimpleString();
+      String jsonString = (sstring == null) ? null : sstring.toString();
+
+      if (jsonString != null)
+      {
+         JSONArray jsonArray = new JSONArray(jsonString);
+
+         return ManagementHelper.fromJSONArray(jsonArray);
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   /**
+    * Returns whether the JMS message corresponds to the result of a 
management operation invocation.
+    */
+   public static boolean isOperationResult(final Message message)
+   {
+      return 
message.containsProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED);
+   }
+
+   /**
+    * Returns whether the JMS message corresponds to the result of a 
management attribute value.
+    */
+   public static boolean isAttributesResult(final Message message)
+   {
+      return !ManagementHelper.isOperationResult(message);
+   }
+
+   /**
+    * Used by HornetQ management service.
+    */
+   public static void storeResult(final Message message, final Object result) 
throws Exception
+   {
+      String resultString;
+
+      if (result != null)
+      {
+         // Result is stored in body, also encoded as JSON array of length 1
+
+         JSONArray jsonArray = ManagementHelper.toJSONArray(new 
Object[]{result});
+
+         resultString = jsonArray.toString();
+      }
+      else
+      {
+         resultString = null;
+      }
+
+      
message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(resultString));
+   }
+
+   /**
+    * Returns the result of an operation invocation or an attribute value.
+    * <br>
+    * If an error occurred on the server, {@link 
#hasOperationSucceeded(Message)} will return {@code false}.
+    * and the result will be a String corresponding to the server exception.
+    */
+   public static Object[] getResults(final Message message) throws Exception
+   {
+      SimpleString sstring = 
message.getBodyBuffer().readNullableSimpleString();
+      String jsonString = (sstring == null) ? null : sstring.toString();
+
+      if (jsonString != null)
+      {
+         JSONArray jsonArray = new JSONArray(jsonString);
+
+         Object[] res = ManagementHelper.fromJSONArray(jsonArray);
+
+         return res;
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   /**
+    * Returns the result of an operation invocation or an attribute value.
+    * <br>
+    * If an error occurred on the server, {@link 
#hasOperationSucceeded(Message)} will return {@code false}.
+    * and the result will be a String corresponding to the server exception.
+    */
+   public static Object getResult(final Message message) throws Exception
+   {
+      Object[] res = ManagementHelper.getResults(message);
+
+      if (res != null)
+      {
+         return res[0];
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   /**
+    * Returns whether the invocation of the management operation on the server 
resource succeeded.
+    */
+   public static boolean hasOperationSucceeded(final Message message)
+   {
+      if (!ManagementHelper.isOperationResult(message))
+      {
+         return false;
+      }
+      if (message.containsProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED))
+      {
+         return 
message.getBooleanProperty(ManagementHelper.HDR_OPERATION_SUCCEEDED);
+      }
+      return false;
+   }
+
+   /**
+    * Used by HornetQ management service.
+    */
+   public static Map<String, Object> fromCommaSeparatedKeyValues(final String 
str) throws Exception
+   {
+      if (str == null || str.trim().length() == 0)
+      {
+         return Collections.emptyMap();
+      }
+
+      // create a JSON array with 1 object:
+      JSONArray array = new JSONArray("[{" + str + "}]");
+      Map<String, Object> params = (Map<String, Object>) 
ManagementHelper.fromJSONArray(array)[0];
+      return params;
+   }
+
+   /**
+    * Used by HornetQ management service.
+    */
+   public static Object[] 
fromCommaSeparatedArrayOfCommaSeparatedKeyValues(final String str) throws 
Exception
+   {
+      if (str == null || str.trim().length() == 0)
+      {
+         return new Object[0];
+      }
+
+      String s = str;
+
+      // if there is a single item, we wrap it in to make it a JSON object
+      if (!s.trim().startsWith("{"))
+      {
+         s = "{" + s + "}";
+      }
+      JSONArray array = new JSONArray("[" + s + "]");
+      return ManagementHelper.fromJSONArray(array);
+   }
+
+   private ManagementHelper()
+   {
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/NotificationType.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/NotificationType.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/NotificationType.java
new file mode 100644
index 0000000..b281c23
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/NotificationType.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+/**
+ * Types of notification emitted by HornetQ servers.
+ * <p>
+ * These notifications can be received through:
+ * <ul>
+ * <li>JMX' MBeans subscriptions
+ * <li>Core messages to a notification address (default value is {@code 
hornetq.notifications})
+ * <li>JMS messages
+ * </ul>
+ * @see the HornetQ user manual section on "Management Notifications"
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public interface NotificationType
+{
+   int getType();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ObjectNameBuilder.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ObjectNameBuilder.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ObjectNameBuilder.java
new file mode 100644
index 0000000..6a821b8
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/ObjectNameBuilder.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import javax.management.ObjectName;
+
+import org.apache.activemq6.api.config.HornetQDefaultConfiguration;
+import org.apache.activemq6.api.core.SimpleString;
+
+/**
+ * Helper class to build ObjectNames for HornetQ resources.
+ * @author <a href="[email protected]">Jeff Mesnil</a>
+ */
+public final class ObjectNameBuilder
+{
+
+   // Constants -----------------------------------------------------
+
+   /**
+    * Default JMX domain for HornetQ resources.
+    */
+   public static final ObjectNameBuilder DEFAULT = new 
ObjectNameBuilder(HornetQDefaultConfiguration.getDefaultJmxDomain());
+
+   static final String JMS_MODULE = "JMS";
+
+   static final String CORE_MODULE = "Core";
+
+   // Attributes ----------------------------------------------------
+
+   private final String domain;
+
+   // Static --------------------------------------------------------
+
+   public static ObjectNameBuilder create(final String domain)
+   {
+      if (domain == null)
+      {
+         return new 
ObjectNameBuilder(HornetQDefaultConfiguration.getDefaultJmxDomain());
+      }
+      else
+      {
+         return new ObjectNameBuilder(domain);
+      }
+   }
+
+   // Constructors --------------------------------------------------
+
+   private ObjectNameBuilder(final String domain)
+   {
+      this.domain = domain;
+   }
+
+   // Public --------------------------------------------------------
+
+   /**
+    * Returns the ObjectName used by the single {@link HornetQServerControl}.
+    */
+   public ObjectName getHornetQServerObjectName() throws Exception
+   {
+      return ObjectName.getInstance(domain + ":module=Core,type=Server");
+   }
+
+   /**
+    * Returns the ObjectName used by AddressControl.
+    *
+    * @see AddressControl
+    */
+   public ObjectName getAddressObjectName(final SimpleString address) throws 
Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, "Address", 
address.toString());
+   }
+
+   /**
+    * Returns the ObjectName used by QueueControl.
+    *
+    * @see QueueControl
+    */
+   public ObjectName getQueueObjectName(final SimpleString address, final 
SimpleString name) throws Exception
+   {
+      return 
ObjectName.getInstance(String.format("%s:module=%s,type=%s,address=%s,name=%s",
+                                                  domain,
+                                                  
ObjectNameBuilder.CORE_MODULE,
+                                                  "Queue",
+                                                  
ObjectName.quote(address.toString()),
+                                                  
ObjectName.quote(name.toString())));
+   }
+
+   /**
+    * Returns the ObjectName used by DivertControl.
+    *
+    * @see DivertControl
+    */
+   public ObjectName getDivertObjectName(final String name) throws Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, "Divert", 
name.toString());
+   }
+
+   /**
+    * Returns the ObjectName used by AcceptorControl.
+    *
+    * @see AcceptorControl
+    */
+   public ObjectName getAcceptorObjectName(final String name) throws Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, "Acceptor", name);
+   }
+
+   /**
+    * Returns the ObjectName used by BroadcastGroupControl.
+    *
+    * @see BroadcastGroupControl
+    */
+   public ObjectName getBroadcastGroupObjectName(final String name) throws 
Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, "BroadcastGroup", 
name);
+   }
+
+   /**
+    * Returns the ObjectName used by BridgeControl.
+    *
+    * @see BridgeControl
+    */
+   public ObjectName getBridgeObjectName(final String name) throws Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, "Bridge", name);
+   }
+
+   /**
+    * Returns the ObjectName used by ClusterConnectionControl.
+    *
+    * @see ClusterConnectionControl
+    */
+   public ObjectName getClusterConnectionObjectName(final String name) throws 
Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, 
"ClusterConnection", name);
+   }
+
+   /**
+    * Returns the ObjectName used by DiscoveryGroupControl.
+    *
+    * @see DiscoveryGroupControl
+    */
+   public ObjectName getDiscoveryGroupObjectName(final String name) throws 
Exception
+   {
+      return createObjectName(ObjectNameBuilder.CORE_MODULE, "DiscoveryGroup", 
name);
+   }
+
+   /**
+    * Returns the ObjectName used by JMSServerControl.
+    * @see org.apache.activemq6.api.jms.management.JMSServerControl
+    */
+   public ObjectName getJMSServerObjectName() throws Exception
+   {
+      return ObjectName.getInstance(domain + ":module=JMS,type=Server");
+   }
+
+   /**
+    * Returns the ObjectName used by JMSQueueControl.
+    * @see org.apache.activemq6.api.jms.management.JMSQueueControl
+    */
+   public ObjectName getJMSQueueObjectName(final String name) throws Exception
+   {
+      return createObjectName(ObjectNameBuilder.JMS_MODULE, "Queue", name);
+   }
+
+   /**
+    * Returns the ObjectName used by TopicControl.
+    *
+    * @see TopicControl
+    */
+   public ObjectName getJMSTopicObjectName(final String name) throws Exception
+   {
+      return createObjectName(ObjectNameBuilder.JMS_MODULE, "Topic", name);
+   }
+
+   /**
+    * Returns the ObjectName used by ConnectionFactoryControl.
+    * @see org.apache.activemq6.api.jms.management.ConnectionFactoryControl
+    */
+   public ObjectName getConnectionFactoryObjectName(final String name) throws 
Exception
+   {
+      return createObjectName(ObjectNameBuilder.JMS_MODULE, 
"ConnectionFactory", name);
+   }
+
+   private ObjectName createObjectName(final String module, final String type, 
final String name) throws Exception
+   {
+      return 
ObjectName.getInstance(String.format("%s:module=%s,type=%s,name=%s",
+                                                  domain,
+                                                  module,
+                                                  type,
+                                                  ObjectName.quote(name)));
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Operation.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Operation.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Operation.java
new file mode 100644
index 0000000..67388cc
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Operation.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.management.MBeanOperationInfo;
+
+/**
+ * Info for a MBean Operation.
+ * <p>
+ * This annotation is used only for methods which can be invoked
+ * through a GUI.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@Inherited
+public @interface Operation
+{
+   String desc();
+
+   int impact() default MBeanOperationInfo.INFO;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Parameter.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Parameter.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Parameter.java
new file mode 100644
index 0000000..75834a5
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/Parameter.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Info for a MBean Operation Parameter.
+ * <p>
+ * This annotation is used only for methods which can be invoked
+ * through a GUI.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+public @interface Parameter
+{
+   String name();
+
+   String desc() default "N/A";
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/QueueControl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/QueueControl.java
 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/QueueControl.java
new file mode 100644
index 0000000..e28e9bb
--- /dev/null
+++ 
b/activemq6-core-client/src/main/java/org/apache/activemq6/api/core/management/QueueControl.java
@@ -0,0 +1,379 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.api.core.management;
+
+import javax.management.MBeanOperationInfo;
+import java.util.Map;
+
+
+/**
+ * A QueueControl is used to manage a queue.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public interface QueueControl
+{
+   // Attributes ----------------------------------------------------
+
+   /**
+    * Returns the name of this queue.
+    */
+   String getName();
+
+   /**
+    * Returns the address this queue is bound to.
+    */
+   String getAddress();
+
+   /**
+    * Returns this queue ID.
+    */
+   long getID();
+
+   /**
+    * Returns whether this queue is temporary.
+    */
+   boolean isTemporary();
+
+   /**
+    * Returns whether this queue is durable.
+    */
+   boolean isDurable();
+
+   /**
+    * Returns the filter associated to this queue.
+    */
+   String getFilter();
+
+   /**
+    * Returns the number of messages currently in this queue.
+    */
+   long getMessageCount();
+
+   /**
+    * Returns the number of scheduled messages in this queue.
+    */
+   long getScheduledCount();
+
+   /**
+    * Returns the number of consumers consuming messages from this queue.
+    */
+   int getConsumerCount();
+
+   /**
+    * Returns the number of messages that this queue is currently delivering 
to its consumers.
+    */
+   int getDeliveringCount();
+
+   /**
+    * Returns the number of messages added to this queue since it was created.
+    */
+   long getMessagesAdded();
+
+   /**
+    * Returns the number of messages added to this queue since it was created.
+    */
+   long getMessagesAcknowledged();
+
+   /**
+    * Returns the first message on the queue as JSON
+    */
+   String getFirstMessageAsJSON() throws Exception;
+
+   /**
+    * Returns the expiry address associated to this queue.
+    */
+   String getExpiryAddress();
+
+   /**
+    * Sets the expiry address associated to this queue to the specified 
expiryAddress.
+    */
+   void setExpiryAddress(@Parameter(name = "expiryAddress", desc = "Expiry 
address of the queue") String expiryAddress) throws Exception;
+
+   /**
+    * Returns the dead-letter address associated to this queue.
+    */
+   String getDeadLetterAddress();
+
+   /**
+    * Sets the dead-letter address associated to this queue to the specified 
deadLetterAddress.
+    */
+   void setDeadLetterAddress(@Parameter(name = "deadLetterAddress", desc = 
"Dead-letter address of the queue") String deadLetterAddress) throws Exception;
+
+   // Operations ----------------------------------------------------
+
+   /**
+    * Lists all the messages scheduled for delivery for this queue.
+    * <br>
+    * 1 Map represents 1 message, keys are the message's properties and 
headers, values are the corresponding values.
+    */
+   @Operation(desc = "List the messages scheduled for delivery", impact = 
MBeanOperationInfo.INFO)
+   Map<String, Object>[] listScheduledMessages() throws Exception;
+
+   /**
+    * Lists all the messages scheduled for delivery for this queue using JSON 
serialization.
+    */
+   @Operation(desc = "List the messages scheduled for delivery and returns 
them using JSON", impact = MBeanOperationInfo.INFO)
+   String listScheduledMessagesAsJSON() throws Exception;
+
+   /**
+    * Lists all the messages being deliver per consumer.
+    * <br>
+    * The Map's key is a toString representation for the consumer. Each 
consumer will then return a {@code Map<String,Object>[]} same way is returned 
by {@link #listScheduledMessages()}
+    */
+   @Operation(desc = "List all messages being delivered per consumer")
+   Map<String, Map<String, Object>[]> listDeliveringMessages() throws 
Exception;
+
+   /**
+    * Executes a conversion of {@link #listDeliveringMessages()} to JSON
+    *
+    * @return
+    * @throws Exception
+    */
+   @Operation(desc = "list all messages being delivered per consumer using 
JSON form")
+   String listDeliveringMessagesAsJSON() throws Exception;
+
+   /**
+    * Lists all the messages in this queue matching the specified filter.
+    * <br>
+    * 1 Map represents 1 message, keys are the message's properties and 
headers, values are the corresponding values.
+    * <br>
+    * Using {@code null} or an empty filter will list <em>all</em> messages 
from this queue.
+    */
+   @Operation(desc = "List all the messages in the queue matching the given 
filter", impact = MBeanOperationInfo.INFO)
+   Map<String, Object>[] listMessages(@Parameter(name = "filter", desc = "A 
message filter (can be empty)") String filter) throws Exception;
+
+   /**
+    * Lists all the messages in this queue matching the specified filter using 
JSON serialization.
+    * <br>
+    * Using {@code null} or an empty filter will list <em>all</em> messages 
from this queue.
+    */
+   @Operation(desc = "List all the messages in the queue matching the given 
filter and returns them using JSON", impact = MBeanOperationInfo.INFO)
+   String listMessagesAsJSON(@Parameter(name = "filter", desc = "A message 
filter (can be empty)") String filter) throws Exception;
+
+   /**
+    * Counts the number of messages in this queue matching the specified 
filter.
+    * <br>
+    * Using {@code null} or an empty filter will count <em>all</em> messages 
from this queue.
+    */
+   @Operation(desc = "Returns the number of the messages in the queue matching 
the given filter", impact = MBeanOperationInfo.INFO)
+   long countMessages(@Parameter(name = "filter", desc = "A message filter 
(can be empty)") String filter) throws Exception;
+
+   /**
+    * Removes the message corresponding to the specified message ID.
+    *
+    * @return {@code true} if the message was removed, {@code false} else
+    */
+   @Operation(desc = "Remove the message corresponding to the given 
messageID", impact = MBeanOperationInfo.ACTION)
+   boolean removeMessage(@Parameter(name = "messageID", desc = "A message ID") 
long messageID) throws Exception;
+
+   /**
+    * Removes all the message corresponding to the specified filter.
+    * <br>
+    * Using {@code null} or an empty filter will remove <em>all</em> messages 
from this queue.
+    *
+    * @return the number of removed messages
+    */
+   @Operation(desc = "Remove the messages corresponding to the given filter 
(and returns the number of removed messages)", impact = 
MBeanOperationInfo.ACTION)
+   int removeMessages(@Parameter(name = "filter", desc = "A message filter 
(can be empty)") String filter) throws Exception;
+
+   /**
+    * Removes all the message corresponding to the specified filter.
+    * <br>
+    * Using {@code null} or an empty filter will remove <em>all</em> messages 
from this queue.
+    *
+    * @return the number of removed messages
+    */
+   @Operation(desc = "Remove the messages corresponding to the given filter 
(and returns the number of removed messages)", impact = 
MBeanOperationInfo.ACTION)
+   int removeMessages(@Parameter(name = "flushLimit", desc = "Limit to flush 
transactions during the operation to avoid OutOfMemory") int flushLimit,
+                      @Parameter(name = "filter", desc = "A message filter 
(can be empty)") String filter) throws Exception;
+
+   /**
+    * Expires all the message corresponding to the specified filter.
+    * <br>
+    * Using {@code null} or an empty filter will expire <em>all</em> messages 
from this queue.
+    *
+    * @return the number of expired messages
+    */
+   @Operation(desc = "Expire the messages corresponding to the given filter 
(and returns the number of expired messages)", impact = 
MBeanOperationInfo.ACTION)
+   int expireMessages(@Parameter(name = "filter", desc = "A message filter") 
String filter) throws Exception;
+
+   /**
+    * Expires the message corresponding to the specified message ID.
+    *
+    * @return {@code true} if the message was expired, {@code false} else
+    */
+   @Operation(desc = "Remove the message corresponding to the given 
messageID", impact = MBeanOperationInfo.ACTION)
+   boolean expireMessage(@Parameter(name = "messageID", desc = "A message ID") 
long messageID) throws Exception;
+
+   /**
+    * Moves the message corresponding to the specified message ID to the 
specified other queue.
+    *
+    * @return {@code true} if the message was moved, {@code false} else
+    */
+   @Operation(desc = "Move the message corresponding to the given messageID to 
another queue. rejectDuplicate=false on this case", impact = 
MBeanOperationInfo.ACTION)
+   boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") 
long messageID,
+                       @Parameter(name = "otherQueueName", desc = "The name of 
the queue to move the message to") String otherQueueName) throws Exception;
+
+   /**
+    * Moves the message corresponding to the specified message ID to the 
specified other queue.
+    *
+    * @return {@code true} if the message was moved, {@code false} else
+    */
+   @Operation(desc = "Move the message corresponding to the given messageID to 
another queue", impact = MBeanOperationInfo.ACTION)
+   boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") 
long messageID,
+                       @Parameter(name = "otherQueueName", desc = "The name of 
the queue to move the message to") String otherQueueName,
+                       @Parameter(name = "rejectDuplicates", desc = "Reject 
messages identified as duplicate by the duplicate message") boolean 
rejectDuplicates) throws Exception;
+
+   /**
+    * Moves all the message corresponding to the specified filter  to the 
specified other queue.
+    * RejectDuplicates = false on this case
+    * <br>
+    * Using {@code null} or an empty filter will move <em>all</em> messages 
from this queue.
+    *
+    * @return the number of moved messages
+    */
+   @Operation(desc = "Move the messages corresponding to the given filter (and 
returns the number of moved messages). RejectDuplicates=false on this case.", 
impact = MBeanOperationInfo.ACTION)
+   int moveMessages(@Parameter(name = "filter", desc = "A message filter (can 
be empty)") String filter,
+                    @Parameter(name = "otherQueueName", desc = "The name of 
the queue to move the messages to") String otherQueueName) throws Exception;
+
+
+   /**
+    * Moves all the message corresponding to the specified filter  to the 
specified other queue.
+    * <br>
+    * Using {@code null} or an empty filter will move <em>all</em> messages 
from this queue.
+    *
+    * @return the number of moved messages
+    */
+   @Operation(desc = "Move the messages corresponding to the given filter (and 
returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
+   int moveMessages(@Parameter(name = "filter", desc = "A message filter (can 
be empty)") String filter,
+                    @Parameter(name = "otherQueueName", desc = "The name of 
the queue to move the messages to") String otherQueueName,
+                    @Parameter(name = "rejectDuplicates", desc = "Reject 
messages identified as duplicate by the duplicate message") boolean 
rejectDuplicates) throws Exception;
+
+   @Operation(desc = "Move the messages corresponding to the given filter (and 
returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
+   int moveMessages(@Parameter(name = "flushLimit", desc = "Limit to flush 
transactions during the operation to avoid OutOfMemory") int flushLimit,
+                    @Parameter(name = "filter", desc = "A message filter (can 
be empty)") String filter,
+                    @Parameter(name = "otherQueueName", desc = "The name of 
the queue to move the messages to") String otherQueueName,
+                    @Parameter(name = "rejectDuplicates", desc = "Reject 
messages identified as duplicate by the duplicate message") boolean 
rejectDuplicates) throws Exception;
+
+   /**
+    * Sends the message corresponding to the specified message ID to this 
queue's dead letter address.
+    *
+    * @return {@code true} if the message was sent to the dead letter address, 
{@code false} else
+    */
+   @Operation(desc = "Send the message corresponding to the given messageID to 
this queue's Dead Letter Address", impact = MBeanOperationInfo.ACTION)
+   boolean sendMessageToDeadLetterAddress(@Parameter(name = "messageID", desc 
= "A message ID") long messageID) throws Exception;
+
+   /**
+    * Sends all the message corresponding to the specified filter to this 
queue's dead letter address.
+    * <br>
+    * Using {@code null} or an empty filter will send <em>all</em> messages 
from this queue.
+    *
+    * @return the number of sent messages
+    */
+   @Operation(desc = "Send the messages corresponding to the given filter to 
this queue's Dead Letter Address", impact = MBeanOperationInfo.ACTION)
+   int sendMessagesToDeadLetterAddress(@Parameter(name = "filter", desc = "A 
message filter (can be empty)") String filterStr) throws Exception;
+
+   /**
+    * Changes the message's priority corresponding to the specified message ID 
to the specified priority.
+    *
+    * @param newPriority between 0 and 9 inclusive.
+    * @return {@code true} if the message priority was changed
+    */
+   @Operation(desc = "Change the priority of the message corresponding to the 
given messageID", impact = MBeanOperationInfo.ACTION)
+   boolean changeMessagePriority(@Parameter(name = "messageID", desc = "A 
message ID") long messageID,
+                                 @Parameter(name = "newPriority", desc = "the 
new priority (between 0 and 9)") int newPriority) throws Exception;
+
+   /**
+    * Changes the priority for all the message corresponding to the specified 
filter to the specified priority.
+    * <br>
+    * Using {@code null} or an empty filter will change <em>all</em> messages 
from this queue.
+    *
+    * @return the number of changed messages
+    */
+   @Operation(desc = "Change the priority of the messages corresponding to the 
given filter", impact = MBeanOperationInfo.ACTION)
+   int changeMessagesPriority(@Parameter(name = "filter", desc = "A message 
filter (can be empty)") String filter,
+                              @Parameter(name = "newPriority", desc = "the new 
priority (between 0 and 9)") int newPriority) throws Exception;
+
+   /**
+    * Lists the message counter for this queue.
+    */
+   @Operation(desc = "List the message counters", impact = 
MBeanOperationInfo.INFO)
+   String listMessageCounter() throws Exception;
+
+   /**
+    * Resets the message counter for this queue.
+    */
+   @Operation(desc = "Reset the message counters", impact = 
MBeanOperationInfo.INFO)
+   void resetMessageCounter() throws Exception;
+
+   /**
+    * Lists the message counter for this queue as a HTML table.
+    */
+   @Operation(desc = "List the message counters as HTML", impact = 
MBeanOperationInfo.INFO)
+   String listMessageCounterAsHTML() throws Exception;
+
+   /**
+    * Lists the message counter history for this queue.
+    */
+   @Operation(desc = "List the message counters history", impact = 
MBeanOperationInfo.INFO)
+   String listMessageCounterHistory() throws Exception;
+
+   /**
+    * Lists the message counter history for this queue as a HTML table.
+    */
+   @Operation(desc = "List the message counters history HTML", impact = 
MBeanOperationInfo.INFO)
+   String listMessageCounterHistoryAsHTML() throws Exception;
+
+   /**
+    * Pauses the queue. Messages are no longer delivered to its consumers.
+    */
+   @Operation(desc = "Pauses the Queue", impact = MBeanOperationInfo.ACTION)
+   void pause() throws Exception;
+
+   /**
+    * Resumes the queue. Messages are again delivered to its consumers.
+    */
+   @Operation(desc = "Resumes delivery of queued messages and gets the queue 
out of paused state.", impact = MBeanOperationInfo.ACTION)
+   void resume() throws Exception;
+
+   @Operation(desc = "List all the existent consumers on the Queue")
+   String listConsumersAsJSON() throws Exception;
+
+   /**
+    * Returns whether the queue is paused.
+    */
+   @Operation(desc = "Inspects if the queue is paused", impact = 
MBeanOperationInfo.INFO)
+   boolean isPaused() throws Exception;
+
+   /**
+    * Resets the MessagesAdded property
+    */
+   @Operation(desc = "Resets the MessagesAdded property", impact = 
MBeanOperationInfo.ACTION)
+   void resetMessagesAdded() throws Exception;
+
+   /**
+    * Resets the MessagesAdded property
+    */
+   @Operation(desc = "Resets the MessagesAcknowledged property", impact = 
MBeanOperationInfo.ACTION)
+   void resetMessagesAcknowledged() throws Exception;
+
+   /**
+    * it will flush one cycle on internal executors, so you would be sure that 
any pending tasks are done before you call
+    * any other measure.
+    * It is useful if you need the exact number of counts on a message
+    * @throws Exception
+    */
+   void flushExecutor();
+
+}

Reply via email to