From 6af85a2cc456feb4abe39d3b02a2345770738426 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 9 Jan 2017 13:32:01 +0000 Subject: [PATCH] couple of small changes to JMX mbeans - no jira --- .../api/core/management/AddressControl.java | 6 ++++++ .../api/core/management/QueueControl.java | 4 ++-- .../core/management/impl/AddressControlImpl.java | 16 ++++++++++++++++ .../core/management/impl/QueueControlImpl.java | 6 +++--- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressControl.java index c48ef88229..92b0082d5b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressControl.java @@ -39,6 +39,12 @@ public interface AddressControl { @Attribute(desc = "Get the delivery modes enabled on this address") Set getDeliveryModes(); + /* + * Whether multicast routing is enabled for this address + * */ + @Attribute(desc = "Get the delivery modes enabled on this address as JSON") + String getDeliveryModesAsJSON() throws Exception; + /** * Returns the roles (name and permissions) associated with this address. */ 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 dbd3ea5364..25c154fffa 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 @@ -357,7 +357,7 @@ public interface QueueControl { */ @Operation(desc = "Sends a TextMessage to a password-protected destination.", impact = MBeanOperationInfo.ACTION) String sendMessage(@Parameter(name = "headers", desc = "The headers to add to the message") Map headers, - @Parameter(name = "headers", desc = "A type for the message") final int type, + @Parameter(name = "type", desc = "A type for the message") final int type, @Parameter(name = "body", desc = "The body (byte[]) of the message encoded as a string using Base64") String body, @Parameter(name = "durable", desc = "Whether the message is durable") boolean durable, @Parameter(name = "user", desc = "The user to authenticate with") String user, @@ -448,7 +448,7 @@ public interface QueueControl { * Resets the MessagesAdded property */ @Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION) - CompositeData[] browse(String filter) throws Exception; + CompositeData[] browse(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception; /** * Resets the MessagesAdded property diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java index 06c21a117a..4547f9e51f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java @@ -101,6 +101,22 @@ public class AddressControlImpl extends AbstractControl implements AddressContro return addressInfo.getRoutingTypes(); } + @Override + public String getDeliveryModesAsJSON() throws Exception { + clearIO(); + try { + JsonArrayBuilder json = JsonLoader.createArrayBuilder(); + Set routingTypes = getDeliveryModes(); + + for (RoutingType routingType : routingTypes) { + json.add(routingType.toString()); + } + return json.build().toString(); + } finally { + blockOnIO(); + } + } + @Override public String[] getQueueNames() throws Exception { clearIO(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java index 3bbbac8bdc..c303b1f750 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java @@ -915,7 +915,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { return browse(null); } @Override - public CompositeData[] browse(String filterStr) throws Exception { + public CompositeData[] browse(String filter) throws Exception { checkStarted(); clearIO(); @@ -923,12 +923,12 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { int pageSize = addressSettingsRepository.getMatch(queue.getName().toString()).getManagementBrowsePageSize(); int currentPageSize = 0; ArrayList c = new ArrayList<>(); - Filter filter = FilterImpl.createFilter(filterStr); + Filter thefilter = FilterImpl.createFilter(filter); queue.flushExecutor(); try (LinkedListIterator iterator = queue.browserIterator()) { while (iterator.hasNext() && currentPageSize++ < pageSize) { MessageReference ref = iterator.next(); - if (filter == null || filter.match(ref.getMessage())) { + if (thefilter == null || thefilter.match(ref.getMessage())) { c.add(OpenTypeSupport.convert(ref)); }