From 2f299334465d6acace1d856079f2f294d8a54914 Mon Sep 17 00:00:00 2001 From: Howard Gao Date: Wed, 6 Dec 2017 13:00:42 +0800 Subject: [PATCH] ARTEMIS-1540 Missing management annotations Some of the management operations are not properly annotated. Also need to add an Operation to list divert names. --- .../apache/activemq/artemis/api/core/Message.java | 4 +++- .../api/core/management/ActiveMQServerControl.java | 12 ++++++++++++ .../artemis/api/core/management/QueueControl.java | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java index 61d887ef17..d7666b56ba 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java @@ -631,7 +631,9 @@ public interface Message { default Map toPropertyMap() { Map map = new HashMap<>(); for (SimpleString name : getPropertyNames()) { - map.put(name.toString(), getObjectProperty(name.toString())); + //some property is SimpleString, which is not available for management console + Object value = getObjectProperty(name.toString()); + map.put(name.toString(), value == null ? null : value.toString()); } return map; } 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 b5150c9331..7c9a40aca4 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 @@ -591,6 +591,7 @@ public interface ActiveMQServerControl { * @return a textual summary of the queue * @throws Exception */ + @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, @Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType, @Parameter(name = "name", desc = "Name of the queue") String name, @@ -811,6 +812,7 @@ public interface ActiveMQServerControl { @Operation(desc = "List all the connection IDs", impact = MBeanOperationInfo.INFO) String[] listConnectionIDs() throws Exception; + @Operation(desc = "List all producers", impact = MBeanOperationInfo.INFO) String listProducersInfoAsJSON() throws Exception; /** @@ -1000,6 +1002,7 @@ public interface ActiveMQServerControl { @Parameter(desc = "allow topics to be created automatically", name = "autoCreateAddresses") boolean autoCreateAddresses, @Parameter(desc = "allow auto-created topics to be deleted automatically", name = "autoDeleteAddresses") boolean autoDeleteAddresses) throws Exception; + @Operation(desc = "Remove address settings", impact = MBeanOperationInfo.ACTION) void removeAddressSettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception; /** @@ -1011,6 +1014,15 @@ public interface ActiveMQServerControl { @Attribute(desc = "names of the diverts deployed on this server") String[] getDivertNames(); + /** + * Jon plugin doesn't recognize an Operation whose name is in + * form getXXXX(), so add this one. + */ + @Operation(desc = "names of the diverts deployed on this server", impact = MBeanOperationInfo.INFO) + default String[] listDivertNames() { + return 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, diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java index 770d12c53c..2ef87432a7 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java @@ -493,6 +493,7 @@ public interface QueueControl { * any other measure. * It is useful if you need the exact number of counts on a message */ + @Operation(desc = "Flush internal executors", impact = MBeanOperationInfo.ACTION) void flushExecutor(); }