This is an automated email from the ASF dual-hosted git repository. clebertsuconic pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push: new ed9270f NO-JIRA Fix small ActiveMQServerControl api break with 2.6.4 new 6c5e90a This closes #2621 ed9270f is described below commit ed9270fc799c2034e7e4c62798c6120b8249edaf Author: Michael André Pearce <michael.andre.pea...@me.com> AuthorDate: Tue Apr 16 14:28:37 2019 +0100 NO-JIRA Fix small ActiveMQServerControl api break with 2.6.4 In adding auto-delete queue level feature, its been noticed as some feature bits were added during hot fix branch, that there's api break with the 2.6.x hotfix branch. This addresses that by fixing this in 2.7.x --- .../api/core/management/ActiveMQServerControl.java | 41 ++++++++++++++++++++++ .../management/impl/ActiveMQServerControlImpl.java | 40 +++++++++++++++++++++ .../ActiveMQServerControlUsingCoreTest.java | 5 +++ 3 files changed, 86 insertions(+) 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 d93fef2..2002935 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 @@ -605,6 +605,47 @@ public interface ActiveMQServerControl { @Parameter(name = "nonDestructive", desc = "If the queue is non-destructive") boolean nonDestructive, @Parameter(name = "consumersBeforeDispatch", desc = "Number of consumers needed before dispatch can start") int consumersBeforeDispatch, @Parameter(name = "delayBeforeDispatch", desc = "Delay to wait before dispatching if number of consumers before dispatch is not met") long delayBeforeDispatch, + @Parameter(name = "autoCreateAddress", desc = "Create an address with default values should a matching address not be found") boolean autoCreateAddress) throws Exception; + + + /** + * Create a queue. + * <br> + * If {@code address} is {@code null} it will be defaulted to {@code name}. + * <br> + * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exits. + * + * @param address address to bind the queue to + * @param routingType the routing type used for this address, {@code MULTICAST} or {@code ANYCAST} + * @param name name of the queue + * @param filterStr filter of the queue + * @param durable is the queue durable? + * @param maxConsumers the maximum number of consumers allowed on this queue at any one time + * @param purgeOnNoConsumers delete this queue when the last consumer disconnects + * @param exclusive if the queue should route exclusively to one consumer + * @param lastValue use last-value semantics + * @param consumersBeforeDispatch number of consumers needed before dispatch can start + * @param delayBeforeDispatch delay to wait before dispatching if number of consumers before dispatch is not met + * @param autoCreateAddress create an address with default values should a matching address not be found + * @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, + @Parameter(name = "filter", desc = "Filter of the queue") String filterStr, + @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable, + @Parameter(name = "maxConsumers", desc = "The maximum number of consumers allowed on this queue at any one time") int maxConsumers, + @Parameter(name = "purgeOnNoConsumers", desc = "Delete this queue when the last consumer disconnects") boolean purgeOnNoConsumers, + @Parameter(name = "exclusive", desc = "If the queue should route exclusively to one consumer") boolean exclusive, + @Parameter(name = "groupRebalance", desc = "If the queue should rebalance groups when a consumer is added") boolean groupRebalance, + @Parameter(name = "groupBuckets", desc = "Number of buckets that should be used for message groups, -1 (default) is unlimited, and groups by raw key instead") int groupBuckets, + @Parameter(name = "lastValue", desc = "Use last-value semantics") boolean lastValue, + @Parameter(name = "lastValueKey", desc = "Use the specified property key for the last value") String lastValueKey, + @Parameter(name = "nonDestructive", desc = "If the queue is non-destructive") boolean nonDestructive, + @Parameter(name = "consumersBeforeDispatch", desc = "Number of consumers needed before dispatch can start") int consumersBeforeDispatch, + @Parameter(name = "delayBeforeDispatch", desc = "Delay to wait before dispatching if number of consumers before dispatch is not met") long delayBeforeDispatch, @Parameter(name = "autoDelete", desc = "If the queue should be deleted once no consumers") boolean autoDelete, @Parameter(name = "autoDeleteDelay", desc = "How long to wait (in milliseconds) before deleting auto-created queues after the queue has 0 consumers") long autoDeleteDelay, @Parameter(name = "autoDeleteMessageCount", desc = "The message count the queue must be at or below before it can be evaluated to be auto deleted, 0 waits until empty queue (default) and -1 disables this check") long autoDeleteMessageCount, 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 d14a358..042279c 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 @@ -978,6 +978,46 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, + boolean autoCreateAddress) throws Exception { + AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(address == null ? name : address); + return createQueue( + address, + routingType, + name, + filterStr, + durable, + maxConsumers, + purgeOnNoConsumers, + exclusive, + groupRebalance, + groupBuckets, + lastValue, + lastValueKey, + nonDestructive, + consumersBeforeDispatch, + delayBeforeDispatch, + addressSettings.isAutoDeleteCreatedQueues(), + addressSettings.getAutoDeleteQueuesDelay(), + addressSettings.getAutoDeleteQueuesMessageCount(), + autoCreateAddress); + } + + @Override + public String createQueue(String address, + String routingType, + String name, + String filterStr, + boolean durable, + int maxConsumers, + boolean purgeOnNoConsumers, + boolean exclusive, + boolean groupRebalance, + int groupBuckets, + boolean lastValue, + String lastValueKey, + boolean nonDestructive, + int consumersBeforeDispatch, + long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, 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 e77b96d..4e4cfb7 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 @@ -205,6 +205,11 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes } @Override + public String createQueue(String address, String routingType, String name, String filter, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, boolean lastValue, String lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoCreateAddress) throws Exception { + return (String) proxy.invokeOperation("createQueue", address, routingType, name, filter, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoCreateAddress); + } + + @Override public String createQueue(String address, String routingType, String name, String filter, boolean durable, int maxConsumers, boolean purgeOnNoConsumers, boolean exclusive, boolean groupRebalance, int groupBuckets, boolean lastValue, String lastValueKey, boolean nonDestructive, int consumersBeforeDispatch, long delayBeforeDispatch, boolean autoDelete, long autoDeleteDelay, long autoDeleteMessageCount, boolean autoCreateAddress) throws Exception { return (String) proxy.invokeOperation("createQueue", address, routingType, name, filter, durable, maxConsumers, purgeOnNoConsumers, exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoCreateAddress); }