activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [2/2] activemq-artemis git commit: NO-JIRA cli improvements
Date Sat, 17 Dec 2016 00:47:45 GMT
NO-JIRA cli improvements


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/1bed2c95
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/1bed2c95
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/1bed2c95

Branch: refs/heads/master
Commit: 1bed2c9512a83bb4198161514d72a3e73df2b2e2
Parents: df1ec5b
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri Dec 16 13:05:20 2016 -0500
Committer: Justin Bertram <jbertram@apache.org>
Committed: Fri Dec 16 18:46:46 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/cli/commands/Create.java   | 41 +++++++++++
 .../artemis/cli/commands/InputAbstract.java     |  6 +-
 .../cli/commands/address/AddressAbstract.java   |  4 +-
 .../cli/commands/address/CreateAddress.java     |  4 +-
 .../cli/commands/address/DeleteAddress.java     |  6 +-
 .../cli/commands/address/ShowAddress.java       | 11 ++-
 .../cli/commands/address/UpdateAddress.java     |  4 +-
 .../artemis/cli/commands/queue/CreateQueue.java |  3 +-
 .../cli/commands/queue/QueueAbstract.java       | 77 +++++++++++++-------
 .../artemis/cli/commands/queue/UpdateQueue.java |  4 +-
 .../artemis/cli/commands/etc/broker.xml         | 18 +++++
 .../core/management/ActiveMQServerControl.java  |  3 +
 .../impl/ActiveMQServerControlImpl.java         | 32 ++++++++
 .../ActiveMQServerControlUsingCoreTest.java     |  5 ++
 14 files changed, 175 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index 5faa7a7..6d8a654 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -185,6 +185,12 @@ public class Create extends InputAbstract {
    @Option(name = "--no-autotune", description = "Disable auto tuning on the journal.")
    boolean noAutoTune;
 
+   @Option(name = "--no-autocreate", description = "Disable Auto create addresses.")
+   Boolean noAutoCreate;
+
+   @Option(name = "--autocreate", description = "Auto create addresses. (default: true)")
+   Boolean autoCreate;
+
    @Option(name = "--user", description = "The username (Default: input)")
    String user;
 
@@ -263,6 +269,38 @@ public class Create extends InputAbstract {
       this.messageLoadBalancing = messageLoadBalancing;
    }
 
+   public Boolean getAutoCreate() {
+      return autoCreate;
+   }
+
+   public Create setAutoCreate(Boolean autoCreate) {
+      this.autoCreate = autoCreate;
+      return this;
+   }
+
+   public Boolean getNoAutoCreate() {
+      return noAutoCreate;
+   }
+
+   public Create setNoAutoCreate(Boolean noAutoCreate) {
+      this.noAutoCreate = noAutoCreate;
+      return this;
+   }
+
+   public boolean isAutoCreate() {
+      if (autoCreate == null) {
+         if (noAutoCreate != null) {
+            autoCreate = !noAutoCreate.booleanValue();
+         }
+      }
+
+      if (autoCreate == null) {
+         autoCreate = true;
+      }
+
+      return autoCreate;
+   }
+
    public String getJavaOptions() {
       return javaOptions;
    }
@@ -720,6 +758,9 @@ public class Create extends InputAbstract {
          filters.put("${full-policy}", "PAGE");
       }
 
+
+      filters.put("${auto-create}", isAutoCreate() ? "true" : "false");
+
       performAutoTune(filters, aio, dataFolder);
 
       write(ETC_BROKER_XML, filters, false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java
index 1b8cd21..9e788f7 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/InputAbstract.java
@@ -70,6 +70,10 @@ public class InputAbstract extends ActionAbstract {
    }
 
    protected String input(String propertyName, String prompt, String silentDefault) {
+      return input(propertyName, prompt, silentDefault, false);
+   }
+
+   protected String input(String propertyName, String prompt, String silentDefault, boolean
acceptNull) {
       if (isSilentInput()) {
          return silentDefault;
       }
@@ -81,7 +85,7 @@ public class InputAbstract extends ActionAbstract {
          context.out.println(propertyName + ": is a mandatory property!");
          context.out.println(prompt);
          inputStr = scanner.nextLine();
-         if (inputStr.trim().equals("")) {
+         if (!acceptNull && inputStr.trim().equals("")) {
             System.out.println("Invalid Entry!");
          } else {
             valid = true;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAbstract.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAbstract.java
index 274b4ff..3eceb03 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAbstract.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/AddressAbstract.java
@@ -42,8 +42,8 @@ public abstract class AddressAbstract extends AbstractAction {
       this.name = name;
    }
 
-   public String getName() {
-      if (name == null) {
+   public String getName(boolean requireInput) {
+      if (name == null && requireInput) {
          name = input("--name", "Provide the name of the address", null);
       }
       return name;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
index bb742e9..9852d43 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/CreateAddress.java
@@ -36,7 +36,7 @@ public class CreateAddress extends AddressAbstract {
       performCoreManagement(new ManagementCallback<ClientMessage>() {
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {
-            ManagementHelper.putOperationInvocation(message, "broker", "createAddress", getName(),
getRoutingTypes(true));
+            ManagementHelper.putOperationInvocation(message, "broker", "createAddress", getName(true),
getRoutingTypes(true));
          }
 
          @Override
@@ -48,7 +48,7 @@ public class CreateAddress extends AddressAbstract {
          @Override
          public void requestFailed(ClientMessage reply) throws Exception {
             String errMsg = (String) ManagementHelper.getResult(reply, String.class);
-            context.err.println("Failed to create address " + getName() + ". Reason: " +
errMsg);
+            context.err.println("Failed to create address " + getName(true) + ". Reason:
" + errMsg);
          }
       });
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
index 76cd22a..e5ef731 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/DeleteAddress.java
@@ -36,18 +36,18 @@ public class DeleteAddress extends AddressAbstract {
       performCoreManagement(new ManagementCallback<ClientMessage>() {
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {
-            ManagementHelper.putOperationInvocation(message, "broker", "deleteAddress", getName());
+            ManagementHelper.putOperationInvocation(message, "broker", "deleteAddress", getName(true));
          }
 
          @Override
          public void requestSuccessful(ClientMessage reply) throws Exception {
-            context.out.println("Address " + getName() + " deleted successfully.");
+            context.out.println("Address " + getName(true) + " deleted successfully.");
          }
 
          @Override
          public void requestFailed(ClientMessage reply) throws Exception {
             String errMsg = (String) ManagementHelper.getResult(reply, String.class);
-            context.err.println("Failed to delete address " + getName() + ". Reason: " +
errMsg);
+            context.err.println("Failed to delete address " + getName(true) + ". Reason:
" + errMsg);
          }
       });
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
index 7a85848..2b79b02 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/ShowAddress.java
@@ -41,10 +41,13 @@ public class ShowAddress extends AddressAbstract {
       performCoreManagement(new ManagementCallback<ClientMessage>() {
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {
-            if (bindings) {
-               ManagementHelper.putOperationInvocation(message, "broker", "listBindingsForAddress",
getName());
+
+            if (getName(false) == null) {
+               ManagementHelper.putOperationInvocation(message, "broker", "listAddresses",
"\n");
+            } else if (bindings) {
+               ManagementHelper.putOperationInvocation(message, "broker", "listBindingsForAddress",
getName(false));
             } else {
-               ManagementHelper.putOperationInvocation(message, "broker", "getAddressInfo",
getName());
+               ManagementHelper.putOperationInvocation(message, "broker", "getAddressInfo",
getName(false));
             }
          }
 
@@ -57,7 +60,7 @@ public class ShowAddress extends AddressAbstract {
          @Override
          public void requestFailed(ClientMessage reply) throws Exception {
             String errMsg = (String) ManagementHelper.getResult(reply, String.class);
-            context.err.println("Failed to show address " + getName() + ". Reason: " + errMsg);
+            context.err.println("Failed to show address " + getName(false) + ". Reason: "
+ errMsg);
          }
       });
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/UpdateAddress.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/UpdateAddress.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/UpdateAddress.java
index f20ba8d..4f56bd9 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/UpdateAddress.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/address/UpdateAddress.java
@@ -37,7 +37,7 @@ public class UpdateAddress extends AddressAbstract {
       performCoreManagement(new AbstractAction.ManagementCallback<ClientMessage>()
{
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {
-            ManagementHelper.putOperationInvocation(message, "broker", "updateAddress", getName(),
getRoutingTypes(false));
+            ManagementHelper.putOperationInvocation(message, "broker", "updateAddress", getName(true),
getRoutingTypes(false));
          }
 
          @Override
@@ -49,7 +49,7 @@ public class UpdateAddress extends AddressAbstract {
          @Override
          public void requestFailed(ClientMessage reply) throws Exception {
             String errMsg = (String) ManagementHelper.getResult(reply, String.class);
-            context.err.println("Failed to update address " + getName() + ". Reason: " +
errMsg);
+            context.err.println("Failed to update address " + getName(true) + ". Reason:
" + errMsg);
          }
       });
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
index 93c8e78..ba3756d 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/CreateQueue.java
@@ -36,8 +36,7 @@ public class CreateQueue extends QueueAbstract {
       performCoreManagement(new ManagementCallback<ClientMessage>() {
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {
-            String address = getAddress();
-            ManagementHelper.putOperationInvocation(message, "broker", "createQueue", address,
getRoutingType(), getName(), getFilter(), isDurable(), getMaxConsumers(-1), treatNoConsumers(true),
isAutoCreateAddress());
+            ManagementHelper.putOperationInvocation(message, "broker", "createQueue", getAddress(true),
getRoutingType(), getName(), getFilter(), isDurable(), getMaxConsumers(-1), isDeleteOnNoConsumers(true),
isAutoCreateAddress());
          }
 
          @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java
index 2194796..6260648 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/QueueAbstract.java
@@ -31,25 +31,28 @@ public class QueueAbstract extends AbstractAction {
    @Option(name = "--address", description = "address of the queue (default queue's name)")
    private String address;
 
-   @Option(name = "--durable", description = "whether the queue is durable or not (default
false)")
-   private boolean durable = false;
+   @Option(name = "--durable", description = "whether the queue is durable or not (default
input)")
+   private Boolean durable;
 
-   @Option(name = "--delete-on-no-consumers", description = "whether to delete this queue
when it's last consumers disconnects)")
-   private boolean deleteOnNoConsumers = false;
+   @Option(name = "--no-durable", description = "whether the queue is durable or not (default
input)")
+   private Boolean noDurable;
 
-   @Option(name = "--keep-on-no-consumers", description = "whether to queue this queue when
it's last consumers disconnects)")
-   private boolean keepOnNoConsumers = false;
+   @Option(name = "--delete-on-no-consumers", description = "whether to delete this queue
when it's last consumers disconnects (default input)")
+   private Boolean deleteOnNoConsumers;
+
+   @Option(name = "--keep-on-no-consumers", description = "whether to queue this queue when
it's last consumers disconnects (default input)")
+   private Boolean keepOnNoConsumers;
 
    @Option(name = "--max-consumers", description = "Maximum number of consumers allowed on
this queue at any one time (default no limit)")
    private Integer maxConsumers;
 
-   @Option(name = "--auto-create-address", description = "Auto create the address (if it
doesn't exist) with default values")
-   private Boolean autoCreateAddress = false;
+   @Option(name = "--auto-create-address", description = "Auto create the address (if it
doesn't exist) with default values (default input)")
+   private Boolean autoCreateAddress;
 
-   @Option(name = "--anycast", description = "It will determine this queue as anycast")
+   @Option(name = "--anycast", description = "It will determine this queue as anycast (default
input)")
    private Boolean anycast;
 
-   @Option(name = "--multicast", description = "It will determine this queue as multicast")
+   @Option(name = "--multicast", description = "It will determine this queue as multicast
(default input)")
    private Boolean multicast;
 
    public void setFilter(String filter) {
@@ -60,14 +63,32 @@ public class QueueAbstract extends AbstractAction {
       return filter;
    }
 
-   public String getAddress() {
+   public String getAddress(boolean requireInput) {
+      // just to force asking the queue name first
+      String queueName = getName();
+
+      if (requireInput && (address == null || "".equals(address.trim()))) {
+         address = input("--address", "Enter the address name. <Enter for " + queueName
+ ">", null, true);
+      }
+
       if (address == null || "".equals(address.trim())) {
-         address = getName();
+         // if still null, it will use the queueName
+         address = queueName;
       }
       return address;
    }
 
    public boolean isDurable() {
+      if (durable == null) {
+         if (noDurable != null) {
+            durable = !noDurable.booleanValue();
+         }
+      }
+
+      if (durable == null) {
+         durable = inputBoolean("--durable", "Is this a durable queue", false);
+      }
+
       return durable;
    }
 
@@ -76,10 +97,6 @@ public class QueueAbstract extends AbstractAction {
       return this;
    }
 
-   public boolean isDeleteOnNoConsumers() {
-      return deleteOnNoConsumers;
-   }
-
    public boolean isKeepOnNoConsumers() {
       return keepOnNoConsumers;
    }
@@ -148,23 +165,33 @@ public class QueueAbstract extends AbstractAction {
       return this;
    }
 
-   public Boolean treatNoConsumers(boolean mandatory) {
+   public Boolean isDeleteOnNoConsumers() {
+      return isDeleteOnNoConsumers(false);
+   }
+
+   public Boolean isDeleteOnNoConsumers(boolean useInput) {
 
       Boolean value = null;
 
-      if (deleteOnNoConsumers) {
-         value = Boolean.TRUE;
-      } else if (keepOnNoConsumers) {
-         value = Boolean.FALSE;
+      if (deleteOnNoConsumers != null) {
+         value = deleteOnNoConsumers.booleanValue();
+      } else if (keepOnNoConsumers != null) {
+         value = !keepOnNoConsumers.booleanValue();
       }
 
 
-      if (value == null && mandatory) {
-         value = Boolean.FALSE;
-         deleteOnNoConsumers = false;
-         keepOnNoConsumers = true;
+      if (value == null && useInput) {
+         value = inputBoolean("--delete-on-no-consumers", "Delete on non consumers", false);
       }
 
+      if (value == null) {
+         // return null if still null
+         return null;
+      }
+
+      deleteOnNoConsumers = value.booleanValue();
+      keepOnNoConsumers = !value.booleanValue();
+
       return value;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java
index cb4d89f..23a92a4 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/queue/UpdateQueue.java
@@ -28,11 +28,11 @@ public class UpdateQueue extends QueueAbstract {
    @Override
    public Object execute(ActionContext context) throws Exception {
       super.execute(context);
-      createQueue(context);
+      updateQueue(context);
       return null;
    }
 
-   private void createQueue(final ActionContext context) throws Exception {
+   private void updateQueue(final ActionContext context) throws Exception {
       performCoreManagement(new ManagementCallback<ClientMessage>() {
          @Override
          public void setUpInvocation(ClientMessage message) throws Exception {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
index 3e0d4e1..51f10c5 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
@@ -85,6 +85,20 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
       </security-settings>
 
       <address-settings>
+         <!-- if you define auto-create on certain queues, management has to be auto-create
-->
+         <address-setting match="activemq.management#">
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <!-- with -1 only the global-max-size is in use for limiting -->
+            <max-size-bytes>-1</max-size-bytes>
+            <message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>${full-policy}</address-full-policy>
+            <auto-create-queues>true</auto-create-queues>
+            <auto-create-addresses>true</auto-create-addresses>
+            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-jms-topics>true</auto-create-jms-topics>
+         </address-setting>
          <!--default for catch all-->
          <address-setting match="#">
             <dead-letter-address>DLQ</dead-letter-address>
@@ -94,6 +108,10 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
             <max-size-bytes>-1</max-size-bytes>
             <message-counter-history-day-limit>10</message-counter-history-day-limit>
             <address-full-policy>${full-policy}</address-full-policy>
+            <auto-create-queues>${auto-create}</auto-create-queues>
+            <auto-create-addresses>${auto-create}</auto-create-addresses>
+            <auto-create-jms-queues>${auto-create}</auto-create-jms-queues>
+            <auto-create-jms-topics>${auto-create}</auto-create-jms-topics>
          </address-setting>
       </address-settings>
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
index 55dcb57..bc68469 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java
@@ -1064,5 +1064,8 @@ public interface ActiveMQServerControl {
 
    @Operation(desc = "Get a list of bindings associated with an address", impact = MBeanOperationInfo.INFO)
    String listBindingsForAddress(String address) throws Exception;
+
+   @Operation(desc = "List Addresses on the broker", impact = MBeanOperationInfo.INFO)
+   String listAddresses(@Parameter(name = "separator", desc = "Separator used on the string
listing") String separator) throws Exception;
 }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index e5e01d0..828971f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -41,6 +41,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 
@@ -901,6 +902,37 @@ public class ActiveMQServerControlImpl extends AbstractControl implements
Active
       }
    }
 
+
+   @Override
+   public String listAddresses(String separator) throws Exception {
+      checkStarted();
+
+      clearIO();
+      try {
+         final Set<SimpleString> addresses = server.getPostOffice().getAddresses();
+         TreeSet<SimpleString> sortAddress = new TreeSet<>(new Comparator<SimpleString>()
{
+            @Override
+            public int compare(SimpleString o1, SimpleString o2) {
+               return o1.toString().compareToIgnoreCase(o2.toString());
+            }
+         });
+
+         sortAddress.addAll(addresses);
+
+         StringBuilder result = new StringBuilder();
+         for (SimpleString string : sortAddress) {
+            if (result.length() > 0) {
+               result.append(separator);
+            }
+            result.append(string);
+         }
+
+         return result.toString();
+      } finally {
+         blockOnIO();
+      }
+   }
+
    @Override
    public int getConnectionCount() {
       checkStarted();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1bed2c95/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
index f74b090..f606035 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlUsingCoreTest.java
@@ -868,6 +868,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
          public String listSessionsAsJSON(@Parameter(desc = "a connection ID", name = "connectionID")
String connectionID) throws Exception {
             return (String) proxy.invokeOperation("listSessionsAsJSON", connectionID);
          }
+
+         @Override
+         public String listAddresses(@Parameter(name = "separator", desc = "Separator used
on the string listing") String separator) throws Exception {
+            return (String) proxy.invokeOperation("listAddresses", separator);
+         }
       };
    }
 


Mime
View raw message