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 643fb53fad..7fb0bf1191 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 @@ -1511,6 +1511,69 @@ public interface ActiveMQServerControl { @Parameter(desc = "prefix to use on auto-create expiry queue", name = "expiryQueuePrefix") String expiryQueuePrefix, @Parameter(desc = "suffix to use on auto-create expiry queue", name = "expiryQueueSuffix") String expiryQueueSuffix) 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, + @Parameter(desc = "allow jms queues to be created automatically", name = "autoCreateJmsQueues") boolean autoCreateJmsQueues, + @Parameter(desc = "allow auto-created jms queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, + @Parameter(desc = "allow jms topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, + @Parameter(desc = "allow auto-created jms topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics, + @Parameter(desc = "allow queues to be created automatically", name = "autoCreateQueues") boolean autoCreateQueues, + @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteQueues") boolean autoDeleteQueues, + @Parameter(desc = "allow addresses to be created automatically", name = "autoCreateAddresses") boolean autoCreateAddresses, + @Parameter(desc = "allow auto-created addresses to be deleted automatically", name = "autoDeleteAddresses") boolean autoDeleteAddresses, + @Parameter(desc = "how to deal with queues deleted from XML at runtime", name = "configDeleteQueues") String configDeleteQueues, + @Parameter(desc = "how to deal with addresses deleted from XML at runtime", name = "configDeleteAddresses") String configDeleteAddresses, + @Parameter(desc = "used with `BLOCK`, the max size an address can reach before messages are rejected; works in combination with `max-size-bytes` for AMQP clients only", name = "maxSizeBytesRejectThreshold") long maxSizeBytesRejectThreshold, + @Parameter(desc = "last-value-key value if none is set on the queue", name = "defaultLastValueKey") String defaultLastValueKey, + @Parameter(desc = "non-destructive value if none is set on the queue", name = "defaultNonDestructive") boolean defaultNonDestructive, + @Parameter(desc = "exclusive value if none is set on the queue", name = "defaultExclusiveQueue") boolean defaultExclusiveQueue, + @Parameter(desc = "group-rebalance value if none is set on the queue", name = "defaultGroupRebalance") boolean defaultGroupRebalance, + @Parameter(desc = "group-buckets value if none is set on the queue", name = "defaultGroupBuckets") int defaultGroupBuckets, + @Parameter(desc = "group-first-key value if none is set on the queue", name = "defaultGroupFirstKey") String defaultGroupFirstKey, + @Parameter(desc = "max-consumers value if none is set on the queue", name = "defaultMaxConsumers") int defaultMaxConsumers, + @Parameter(desc = "purge-on-no-consumers value if none is set on the queue", name = "defaultPurgeOnNoConsumers") boolean defaultPurgeOnNoConsumers, + @Parameter(desc = "consumers-before-dispatch value if none is set on the queue", name = "defaultConsumersBeforeDispatch") int defaultConsumersBeforeDispatch, + @Parameter(desc = "delay-before-dispatch value if none is set on the queue", name = "defaultDelayBeforeDispatch") long defaultDelayBeforeDispatch, + @Parameter(desc = "routing-type value if none is set on the queue", name = "defaultQueueRoutingType") String defaultQueueRoutingType, + @Parameter(desc = "routing-type value if none is set on the address", name = "defaultAddressRoutingType") String defaultAddressRoutingType, + @Parameter(desc = "consumer-window-size value if none is set on the queue", name = "defaultConsumerWindowSize") int defaultConsumerWindowSize, + @Parameter(desc = "ring-size value if none is set on the queue", name = "defaultRingSize") long defaultRingSize, + @Parameter(desc = "allow created queues to be deleted automatically", name = "autoDeleteCreatedQueues") boolean autoDeleteCreatedQueues, + @Parameter(desc = "delay for deleting auto-created queues", name = "autoDeleteQueuesDelay") long autoDeleteQueuesDelay, + @Parameter(desc = "the message count the queue must be at or below before it can be auto deleted", name = "autoDeleteQueuesMessageCount") long autoDeleteQueuesMessageCount, + @Parameter(desc = "delay for deleting auto-created addresses", name = "autoDeleteAddressesDelay") long autoDeleteAddressesDelay, + @Parameter(desc = "factor by which to modify the redelivery delay slightly to avoid collisions", name = "redeliveryCollisionAvoidanceFactor") double redeliveryCollisionAvoidanceFactor, + @Parameter(desc = "the number of messages to preserve for future queues created on the matching address", name = "retroactiveMessageCount") long retroactiveMessageCount, + @Parameter(desc = "allow dead-letter address & queue to be created automatically", name = "autoCreateDeadLetterResources") boolean autoCreateDeadLetterResources, + @Parameter(desc = "prefix to use on auto-create dead-letter queue", name = "deadLetterQueuePrefix") String deadLetterQueuePrefix, + @Parameter(desc = "suffix to use on auto-create dead-letter queue", name = "deadLetterQueueSuffix") String deadLetterQueueSuffix, + @Parameter(desc = "allow expiry address & queue to be created automatically", name = "autoCreateExpiryResources") boolean autoCreateExpiryResources, + @Parameter(desc = "prefix to use on auto-create expiry queue", name = "expiryQueuePrefix") String expiryQueuePrefix, + @Parameter(desc = "suffix to use on auto-create expiry queue", name = "expiryQueueSuffix") String expiryQueueSuffix, + @Parameter(desc = "the minimum expiry delay setting", name = "minExpiryDelay") long minExpiryDelay, + @Parameter(desc = "the maximum expiry delay setting", name = "maxExpiryDelay") long maxExpiryDelay, + @Parameter(desc = "whether or not to enable metrics", name = "enableMetrics") boolean enableMetrics) throws Exception; + @Operation(desc = "Remove address settings", impact = MBeanOperationInfo.ACTION) void removeAddressSettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfo.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfo.java index 5bd9037e19..5e488d906a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfo.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfo.java @@ -129,6 +129,14 @@ public final class AddressSettingsInfo { private final String expiryQueueSuffix; + private final long expiryDelay; + + private final long minExpiryDelay; + + private final long maxExpiryDelay; + + private final boolean enableMetrics; + // Static -------------------------------------------------------- public static AddressSettingsInfo from(final String jsonString) { @@ -185,7 +193,11 @@ public final class AddressSettingsInfo { object.getString("deadLetterQueueSuffix"), object.getBoolean("autoCreateExpiryResources"), object.getString("expiryQueuePrefix"), - object.getString("expiryQueueSuffix")); + object.getString("expiryQueueSuffix"), + object.getJsonNumber("expiryDelay").longValue(), + object.getJsonNumber("minExpiryDelay").longValue(), + object.getJsonNumber("maxExpiryDelay").longValue(), + object.getBoolean("enableMetrics")); } // Constructors -------------------------------------------------- @@ -242,7 +254,11 @@ public final class AddressSettingsInfo { String deadLetterQueueSuffix, boolean autoCreateExpiryResources, String expiryQueuePrefix, - String expiryQueueSuffix) { + String expiryQueueSuffix, + long expiryDelay, + long minExpiryDelay, + long maxExpiryDelay, + boolean enableMetrics) { this.addressFullMessagePolicy = addressFullMessagePolicy; this.maxSizeBytes = maxSizeBytes; this.pageSizeBytes = pageSizeBytes; @@ -296,6 +312,10 @@ public final class AddressSettingsInfo { this.autoCreateExpiryResources = autoCreateExpiryResources; this.expiryQueuePrefix = expiryQueuePrefix; this.expiryQueueSuffix = expiryQueueSuffix; + this.expiryDelay = expiryDelay; + this.minExpiryDelay = minExpiryDelay; + this.maxExpiryDelay = maxExpiryDelay; + this.enableMetrics = enableMetrics; } // Public -------------------------------------------------------- @@ -519,5 +539,21 @@ public final class AddressSettingsInfo { public String getExpiryQueueSuffix() { return expiryQueueSuffix; } + + public long getExpiryDelay() { + return expiryDelay; + } + + public long getMinExpiryDelay() { + return minExpiryDelay; + } + + public long getMaxExpiryDelay() { + return maxExpiryDelay; + } + + public boolean isEnableMetrics() { + return enableMetrics; + } } diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfoTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfoTest.java index 4aee4d8783..53225339f7 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfoTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/api/core/management/AddressSettingsInfoTest.java @@ -83,7 +83,11 @@ public class AddressSettingsInfoTest { "\"deadLetterQueueSuffix\":\".FOO\",\n" + "\"autoCreateExpiryResources\":true,\n" + "\"expiryQueuePrefix\":\"BAR.\",\n" + - "\"expiryQueueSuffix\":\".BAR\"\n" + + "\"expiryQueueSuffix\":\".BAR\",\n" + + "\"expiryDelay\":404,\n" + + "\"minExpiryDelay\":40,\n" + + "\"maxExpiryDelay\":4004,\n" + + "\"enableMetrics\":false\n" + "}"; AddressSettingsInfo addressSettingsInfo = AddressSettingsInfo.from(json); assertEquals("fullPolicy", addressSettingsInfo.getAddressFullMessagePolicy()); @@ -139,6 +143,10 @@ public class AddressSettingsInfoTest { assertTrue(addressSettingsInfo.isAutoCreateExpiryResources()); assertEquals("BAR.", addressSettingsInfo.getExpiryQueuePrefix()); assertEquals(".BAR", addressSettingsInfo.getExpiryQueueSuffix()); + assertEquals(404, addressSettingsInfo.getExpiryDelay()); + assertEquals(40, addressSettingsInfo.getMinExpiryDelay()); + assertEquals(4004, addressSettingsInfo.getMaxExpiryDelay()); + assertEquals(false, addressSettingsInfo.isEnableMetrics()); } } 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 d72611c581..62be7a60c3 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 @@ -2866,8 +2866,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } return settings.add("expiryDelay", addressSettings.getExpiryDelay()) - .add("minExpiryDelay", addressSettings.getExpiryDelay()) - .add("maxExpiryDelay", addressSettings.getExpiryDelay()) + .add("minExpiryDelay", addressSettings.getMinExpiryDelay()) + .add("maxExpiryDelay", addressSettings.getMaxExpiryDelay()) .add("maxDeliveryAttempts", addressSettings.getMaxDeliveryAttempts()) .add("pageCacheMaxSize", addressSettings.getPageCacheMaxSize()) .add("maxSizeBytes", addressSettings.getMaxSizeBytes()) @@ -2919,6 +2919,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active .add("autoCreateExpiryResources", addressSettings.isAutoCreateExpiryResources()) .add("expiryQueuePrefix", addressSettings.getExpiryQueuePrefix().toString()) .add("expiryQueueSuffix", addressSettings.getExpiryQueueSuffix().toString()) + .add("enableMetrics", addressSettings.isEnableMetrics()) .build() .toString(); } @@ -3215,6 +3216,125 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active final boolean autoCreateExpiryResources, final String expiryQueuePrefix, final String expiryQueueSuffix) throws Exception { + addAddressSettings(address, + DLA, + expiryAddress, + expiryDelay, + defaultLastValueQueue, + maxDeliveryAttempts, + maxSizeBytes, + pageSizeBytes, + pageMaxCacheSize, + redeliveryDelay, + redeliveryMultiplier, + maxRedeliveryDelay, + redistributionDelay, + sendToDLAOnNoRoute, + addressFullMessagePolicy, + slowConsumerThreshold, + slowConsumerCheckPeriod, + slowConsumerPolicy, + autoCreateJmsQueues, + autoDeleteJmsQueues, + autoCreateJmsTopics, + autoDeleteJmsTopics, + autoCreateQueues, + autoDeleteQueues, + autoCreateAddresses, + autoDeleteAddresses, + configDeleteQueues, + configDeleteAddresses, + maxSizeBytesRejectThreshold, + defaultLastValueKey, + defaultNonDestructive, + defaultExclusiveQueue, + defaultGroupRebalance, + defaultGroupBuckets, + defaultGroupFirstKey, + defaultMaxConsumers, + defaultPurgeOnNoConsumers, + defaultConsumersBeforeDispatch, + defaultDelayBeforeDispatch, + defaultQueueRoutingType, + defaultAddressRoutingType, + defaultConsumerWindowSize, + defaultRingSize, + autoDeleteCreatedQueues, + autoDeleteQueuesDelay, + autoDeleteQueuesMessageCount, + autoDeleteAddressesDelay, + redeliveryCollisionAvoidanceFactor, + retroactiveMessageCount, + AddressSettings.DEFAULT_AUTO_CREATE_DEAD_LETTER_RESOURCES, + AddressSettings.DEFAULT_DEAD_LETTER_QUEUE_PREFIX.toString(), + AddressSettings.DEFAULT_DEAD_LETTER_QUEUE_SUFFIX.toString(), + AddressSettings.DEFAULT_AUTO_CREATE_EXPIRY_RESOURCES, + AddressSettings.DEFAULT_EXPIRY_QUEUE_PREFIX.toString(), + AddressSettings.DEFAULT_EXPIRY_QUEUE_SUFFIX.toString(), + AddressSettings.DEFAULT_MIN_EXPIRY_DELAY, + AddressSettings.DEFAULT_MAX_EXPIRY_DELAY, + AddressSettings.DEFAULT_ENABLE_METRICS); + } + + @Override + public void addAddressSettings(final String address, + final String DLA, + final String expiryAddress, + final long expiryDelay, + final boolean defaultLastValueQueue, + final int maxDeliveryAttempts, + final long maxSizeBytes, + final int pageSizeBytes, + final int pageMaxCacheSize, + final long redeliveryDelay, + final double redeliveryMultiplier, + final long maxRedeliveryDelay, + final long redistributionDelay, + final boolean sendToDLAOnNoRoute, + final String addressFullMessagePolicy, + final long slowConsumerThreshold, + final long slowConsumerCheckPeriod, + final String slowConsumerPolicy, + final boolean autoCreateJmsQueues, + final boolean autoDeleteJmsQueues, + final boolean autoCreateJmsTopics, + final boolean autoDeleteJmsTopics, + final boolean autoCreateQueues, + final boolean autoDeleteQueues, + final boolean autoCreateAddresses, + final boolean autoDeleteAddresses, + final String configDeleteQueues, + final String configDeleteAddresses, + final long maxSizeBytesRejectThreshold, + final String defaultLastValueKey, + final boolean defaultNonDestructive, + final boolean defaultExclusiveQueue, + final boolean defaultGroupRebalance, + final int defaultGroupBuckets, + final String defaultGroupFirstKey, + final int defaultMaxConsumers, + final boolean defaultPurgeOnNoConsumers, + final int defaultConsumersBeforeDispatch, + final long defaultDelayBeforeDispatch, + final String defaultQueueRoutingType, + final String defaultAddressRoutingType, + final int defaultConsumerWindowSize, + final long defaultRingSize, + final boolean autoDeleteCreatedQueues, + final long autoDeleteQueuesDelay, + final long autoDeleteQueuesMessageCount, + final long autoDeleteAddressesDelay, + final double redeliveryCollisionAvoidanceFactor, + final long retroactiveMessageCount, + final boolean autoCreateDeadLetterResources, + final String deadLetterQueuePrefix, + final String deadLetterQueueSuffix, + final boolean autoCreateExpiryResources, + final String expiryQueuePrefix, + final String expiryQueueSuffix, + final long minExpiryDelay, + final long maxExpiryDelay, + final boolean enableMetrics) throws Exception { if (AuditLogger.isEnabled()) { AuditLogger.addAddressSettings(this.server, address, DLA, expiryAddress, expiryDelay, defaultLastValueQueue, maxDeliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, @@ -3228,7 +3348,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active defaultRingSize, autoDeleteCreatedQueues, autoDeleteQueuesDelay, autoDeleteQueuesMessageCount, autoDeleteAddressesDelay, redeliveryCollisionAvoidanceFactor, retroactiveMessageCount, autoCreateDeadLetterResources, deadLetterQueuePrefix, deadLetterQueueSuffix, autoCreateExpiryResources, expiryQueuePrefix, - expiryQueueSuffix); + expiryQueueSuffix, minExpiryDelay, maxExpiryDelay, enableMetrics); } checkStarted(); @@ -3245,6 +3365,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active addressSettings.setDeadLetterAddress(DLA == null ? null : new SimpleString(DLA)); addressSettings.setExpiryAddress(expiryAddress == null ? null : new SimpleString(expiryAddress)); addressSettings.setExpiryDelay(expiryDelay); + addressSettings.setMinExpiryDelay(minExpiryDelay); + addressSettings.setMaxExpiryDelay(maxExpiryDelay); addressSettings.setDefaultLastValueQueue(defaultLastValueQueue); addressSettings.setMaxDeliveryAttempts(maxDeliveryAttempts); addressSettings.setPageCacheMaxSize(pageMaxCacheSize); @@ -3296,6 +3418,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active addressSettings.setAutoCreateExpiryResources(autoCreateExpiryResources); addressSettings.setExpiryQueuePrefix(expiryQueuePrefix == null ? null : new SimpleString(expiryQueuePrefix)); addressSettings.setExpiryQueueSuffix(expiryQueueSuffix == null ? null : new SimpleString(expiryQueueSuffix)); + addressSettings.setEnableMetrics(enableMetrics); server.getAddressSettingsRepository().addMatch(address, addressSettings); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index de33d7113e..53cd3c5fe0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -811,7 +811,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { String DLA = "someDLA"; String expiryAddress = "someExpiry"; - long expiryDelay = -1; + long expiryDelay = RandomUtil.randomPositiveLong(); + long minExpiryDelay = RandomUtil.randomPositiveLong(); + long maxExpiryDelay = RandomUtil.randomPositiveLong(); boolean lastValueQueue = true; int deliveryAttempts = 1; long maxSizeBytes = 20; @@ -863,6 +865,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { boolean autoCreateExpiryResources = RandomUtil.randomBoolean(); String expiryQueuePrefix = RandomUtil.randomString(); String expiryQueueSuffix = RandomUtil.randomString(); + boolean enableMetrics = RandomUtil.randomBoolean(); serverControl.addAddressSettings(addressMatch, DLA, @@ -918,7 +921,10 @@ public class ActiveMQServerControlTest extends ManagementTestBase { deadLetterQueueSuffix, autoCreateExpiryResources, expiryQueuePrefix, - expiryQueueSuffix); + expiryQueueSuffix, + minExpiryDelay, + maxExpiryDelay, + enableMetrics); boolean ex = false; try { @@ -976,7 +982,10 @@ public class ActiveMQServerControlTest extends ManagementTestBase { deadLetterQueueSuffix, autoCreateExpiryResources, expiryQueuePrefix, - expiryQueueSuffix); + expiryQueueSuffix, + minExpiryDelay, + maxExpiryDelay, + enableMetrics); } catch (Exception expected) { ex = true; } @@ -990,6 +999,9 @@ public class ActiveMQServerControlTest extends ManagementTestBase { assertEquals(DLA, info.getDeadLetterAddress()); assertEquals(expiryAddress, info.getExpiryAddress()); + assertEquals(expiryDelay, info.getExpiryDelay()); + assertEquals(minExpiryDelay, info.getMinExpiryDelay()); + assertEquals(maxExpiryDelay, info.getMaxExpiryDelay()); assertEquals(lastValueQueue, info.isLastValueQueue()); assertEquals(deliveryAttempts, info.getMaxDeliveryAttempts()); assertEquals(maxSizeBytes, info.getMaxSizeBytes()); @@ -1041,6 +1053,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { assertEquals(autoCreateExpiryResources, info.isAutoCreateExpiryResources()); assertEquals(expiryQueuePrefix, info.getExpiryQueuePrefix()); assertEquals(expiryQueueSuffix, info.getExpiryQueueSuffix()); + assertEquals(enableMetrics, info.isEnableMetrics()); serverControl.addAddressSettings(addressMatch, DLA, @@ -1096,13 +1109,19 @@ public class ActiveMQServerControlTest extends ManagementTestBase { deadLetterQueueSuffix, autoCreateExpiryResources, expiryQueuePrefix, - expiryQueueSuffix); + expiryQueueSuffix, + minExpiryDelay, + maxExpiryDelay, + enableMetrics); jsonString = serverControl.getAddressSettingsAsJSON(exactAddress); info = AddressSettingsInfo.from(jsonString); assertEquals(DLA, info.getDeadLetterAddress()); assertEquals(expiryAddress, info.getExpiryAddress()); + assertEquals(expiryDelay, info.getExpiryDelay()); + assertEquals(minExpiryDelay, info.getMinExpiryDelay()); + assertEquals(maxExpiryDelay, info.getMaxExpiryDelay()); assertEquals(lastValueQueue, info.isLastValueQueue()); assertEquals(deliveryAttempts, info.getMaxDeliveryAttempts()); assertEquals(-1, info.getMaxSizeBytes()); @@ -1154,6 +1173,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { assertEquals(autoCreateExpiryResources, info.isAutoCreateExpiryResources()); assertEquals(expiryQueuePrefix, info.getExpiryQueuePrefix()); assertEquals(expiryQueueSuffix, info.getExpiryQueueSuffix()); + assertEquals(enableMetrics, info.isEnableMetrics()); ex = false; try { @@ -1211,7 +1231,10 @@ public class ActiveMQServerControlTest extends ManagementTestBase { deadLetterQueueSuffix, autoCreateExpiryResources, expiryQueuePrefix, - expiryQueueSuffix); + expiryQueueSuffix, + minExpiryDelay, + maxExpiryDelay, + enableMetrics); } catch (Exception e) { ex = true; } 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 0b4c674817..9e3da08d89 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 @@ -1169,6 +1169,126 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes expiryQueueSuffix); } + @Override + public 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, + @Parameter(desc = "allow jms queues to be created automatically", name = "autoCreateJmsQueues") boolean autoCreateJmsQueues, + @Parameter(desc = "allow auto-created jms queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, + @Parameter(desc = "allow jms topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, + @Parameter(desc = "allow auto-created jms topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics, + @Parameter(desc = "allow queues to be created automatically", name = "autoCreateQueues") boolean autoCreateQueues, + @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteQueues") boolean autoDeleteQueues, + @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, + @Parameter(desc = "how to deal with queues deleted from XML at runtime", name = "configDeleteQueues") String configDeleteQueues, + @Parameter(desc = "how to deal with addresses deleted from XML at runtime", name = "configDeleteAddresses") String configDeleteAddresses, + @Parameter(desc = "used with `BLOCK`, the max size an address can reach before messages are rejected; works in combination with `max-size-bytes` for AMQP clients only", name = "maxSizeBytesRejectThreshold") long maxSizeBytesRejectThreshold, + @Parameter(desc = "last-value-key value if none is set on the queue", name = "defaultLastValueKey") String defaultLastValueKey, + @Parameter(desc = "non-destructive value if none is set on the queue", name = "defaultNonDestructive") boolean defaultNonDestructive, + @Parameter(desc = "exclusive value if none is set on the queue", name = "defaultExclusiveQueue") boolean defaultExclusiveQueue, + @Parameter(desc = "group-rebalance value if none is set on the queue", name = "defaultGroupRebalance") boolean defaultGroupRebalance, + @Parameter(desc = "group-buckets value if none is set on the queue", name = "defaultGroupBuckets") int defaultGroupBuckets, + @Parameter(desc = "group-first-key value if none is set on the queue", name = "defaultGroupFirstKey") String defaultGroupFirstKey, + @Parameter(desc = "max-consumers value if none is set on the queue", name = "defaultMaxConsumers") int defaultMaxConsumers, + @Parameter(desc = "purge-on-no-consumers value if none is set on the queue", name = "defaultPurgeOnNoConsumers") boolean defaultPurgeOnNoConsumers, + @Parameter(desc = "consumers-before-dispatch value if none is set on the queue", name = "defaultConsumersBeforeDispatch") int defaultConsumersBeforeDispatch, + @Parameter(desc = "delay-before-dispatch value if none is set on the queue", name = "defaultDelayBeforeDispatch") long defaultDelayBeforeDispatch, + @Parameter(desc = "routing-type value if none is set on the queue", name = "defaultQueueRoutingType") String defaultQueueRoutingType, + @Parameter(desc = "routing-type value if none is set on the address", name = "defaultAddressRoutingType") String defaultAddressRoutingType, + @Parameter(desc = "consumer-window-size value if none is set on the queue", name = "defaultConsumerWindowSize") int defaultConsumerWindowSize, + @Parameter(desc = "ring-size value if none is set on the queue", name = "defaultRingSize") long defaultRingSize, + @Parameter(desc = "allow created queues to be deleted automatically", name = "autoDeleteCreatedQueues") boolean autoDeleteCreatedQueues, + @Parameter(desc = "delay for deleting auto-created queues", name = "autoDeleteQueuesDelay") long autoDeleteQueuesDelay, + @Parameter(desc = "the message count the queue must be at or below before it can be auto deleted", name = "autoDeleteQueuesMessageCount") long autoDeleteQueuesMessageCount, + @Parameter(desc = "delay for deleting auto-created addresses", name = "autoDeleteAddressesDelay") long autoDeleteAddressesDelay, + @Parameter(desc = "factor by which to modify the redelivery delay slightly to avoid collisions", name = "redeliveryCollisionAvoidanceFactor") double redeliveryCollisionAvoidanceFactor, + @Parameter(desc = "the number of messages to preserve for future queues created on the matching address", name = "retroactiveMessageCount") long retroactiveMessageCount, + @Parameter(desc = "allow dead-letter address & queue to be created automatically", name = "autoCreateDeadLetterResources") boolean autoCreateDeadLetterResources, + @Parameter(desc = "prefix to use on auto-create dead-letter queue", name = "deadLetterQueuePrefix") String deadLetterQueuePrefix, + @Parameter(desc = "suffix to use on auto-create dead-letter queue", name = "deadLetterQueueSuffix") String deadLetterQueueSuffix, + @Parameter(desc = "allow expiry address & queue to be created automatically", name = "autoCreateExpiryResources") boolean autoCreateExpiryResources, + @Parameter(desc = "prefix to use on auto-create expiry queue", name = "expiryQueuePrefix") String expiryQueuePrefix, + @Parameter(desc = "suffix to use on auto-create expiry queue", name = "expiryQueueSuffix") String expiryQueueSuffix, + @Parameter(desc = "the min expiry delay setting", name = "minExpiryDelay") long minExpiryDelay, + @Parameter(desc = "the max expiry delay setting", name = "maxExpiryDelay") long maxExpiryDelay, + @Parameter(desc = "whether or not to enable metrics", name = "enableMetrics") boolean enableMetrics) throws Exception { + proxy.invokeOperation("addAddressSettings", + addressMatch, + DLA, + expiryAddress, + expiryDelay, + lastValueQueue, + deliveryAttempts, + maxSizeBytes, + pageSizeBytes, + pageMaxCacheSize, + redeliveryDelay, + redeliveryMultiplier, + maxRedeliveryDelay, + redistributionDelay, + sendToDLAOnNoRoute, + addressFullMessagePolicy, + slowConsumerThreshold, + slowConsumerCheckPeriod, + slowConsumerPolicy, + autoCreateJmsQueues, + autoDeleteJmsQueues, + autoCreateJmsTopics, + autoDeleteJmsTopics, + autoCreateQueues, + autoDeleteQueues, + autoCreateAddresses, + autoDeleteAddresses, + configDeleteQueues, + configDeleteAddresses, + maxSizeBytesRejectThreshold, + defaultLastValueKey, + defaultNonDestructive, + defaultExclusiveQueue, + defaultGroupRebalance, + defaultGroupBuckets, + defaultGroupFirstKey, + defaultMaxConsumers, + defaultPurgeOnNoConsumers, + defaultConsumersBeforeDispatch, + defaultDelayBeforeDispatch, + defaultQueueRoutingType, + defaultAddressRoutingType, + defaultConsumerWindowSize, + defaultRingSize, + autoDeleteCreatedQueues, + autoDeleteQueuesDelay, + autoDeleteQueuesMessageCount, + autoDeleteAddressesDelay, + redeliveryCollisionAvoidanceFactor, + retroactiveMessageCount, + autoCreateDeadLetterResources, + deadLetterQueuePrefix, + deadLetterQueueSuffix, + autoCreateExpiryResources, + expiryQueuePrefix, + expiryQueueSuffix, + minExpiryDelay, + maxExpiryDelay, + enableMetrics); + } + @Override public String listNetworkTopology() throws Exception { return (String) proxy.invokeOperation("listNetworkTopology");