ARTEMIS-2529 update address-settings mngmnt
This commit is contained in:
parent
47a5406ca2
commit
c0e77e96d1
|
@ -1330,8 +1330,61 @@ public interface ActiveMQServerControl {
|
|||
@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) throws Exception;
|
||||
@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) 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) throws Exception;
|
||||
|
||||
@Operation(desc = "Remove address settings", impact = MBeanOperationInfo.ACTION)
|
||||
void removeAddressSettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception;
|
||||
|
|
|
@ -63,11 +63,108 @@ public final class AddressSettingsInfo {
|
|||
|
||||
private final boolean autoDeleteJmsTopics;
|
||||
|
||||
private final boolean autoCreateQueues;
|
||||
|
||||
private final boolean autoDeleteQueues;
|
||||
|
||||
private final boolean autoCreateAddresses;
|
||||
|
||||
private final boolean autoDeleteAddresses;
|
||||
|
||||
private final String configDeleteQueues;
|
||||
|
||||
private final String configDeleteAddresses;
|
||||
|
||||
private final long maxSizeBytesRejectThreshold;
|
||||
|
||||
private final String defaultLastValueKey;
|
||||
|
||||
private final boolean defaultNonDestructive;
|
||||
|
||||
private final boolean defaultExclusiveQueue;
|
||||
|
||||
private final boolean defaultGroupRebalance;
|
||||
|
||||
private final int defaultGroupBuckets;
|
||||
|
||||
private final String defaultGroupFirstKey;
|
||||
|
||||
private final int defaultMaxConsumers;
|
||||
|
||||
private final boolean defaultPurgeOnNoConsumers;
|
||||
|
||||
private final int defaultConsumersBeforeDispatch;
|
||||
|
||||
private final long defaultDelayBeforeDispatch;
|
||||
|
||||
private final String defaultQueueRoutingType;
|
||||
|
||||
private final String defaultAddressRoutingType;
|
||||
|
||||
private final int defaultConsumerWindowSize;
|
||||
|
||||
private final long defaultRingSize;
|
||||
|
||||
private final boolean autoDeleteCreatedQueues;
|
||||
|
||||
private final long autoDeleteQueuesDelay;
|
||||
|
||||
private final long autoDeleteQueuesMessageCount;
|
||||
|
||||
private final long autoDeleteAddressesDelay;
|
||||
|
||||
private final double redeliveryCollisionAvoidanceFactor;
|
||||
|
||||
// Static --------------------------------------------------------
|
||||
|
||||
public static AddressSettingsInfo from(final String jsonString) {
|
||||
JsonObject object = JsonUtil.readJsonObject(jsonString);
|
||||
return new AddressSettingsInfo(object.getString("addressFullMessagePolicy"), object.getJsonNumber("maxSizeBytes").longValue(), object.getInt("pageSizeBytes"), object.getInt("pageCacheMaxSize"), object.getInt("maxDeliveryAttempts"), object.getJsonNumber("redeliveryDelay").longValue(), object.getJsonNumber("redeliveryMultiplier").doubleValue(), object.getJsonNumber("maxRedeliveryDelay").longValue(), object.getString("DLA"), object.getString("expiryAddress"), object.getBoolean("lastValueQueue"), object.getJsonNumber("redistributionDelay").longValue(), object.getBoolean("sendToDLAOnNoRoute"), object.getJsonNumber("slowConsumerThreshold").longValue(), object.getJsonNumber("slowConsumerCheckPeriod").longValue(), object.getString("slowConsumerPolicy"), object.getBoolean("autoCreateJmsQueues"), object.getBoolean("autoCreateJmsTopics"), object.getBoolean("autoDeleteJmsQueues"), object.getBoolean("autoDeleteJmsTopics"));
|
||||
return new AddressSettingsInfo(object.getString("addressFullMessagePolicy"),
|
||||
object.getJsonNumber("maxSizeBytes").longValue(),
|
||||
object.getInt("pageSizeBytes"),
|
||||
object.getInt("pageCacheMaxSize"),
|
||||
object.getInt("maxDeliveryAttempts"),
|
||||
object.getJsonNumber("redeliveryDelay").longValue(),
|
||||
object.getJsonNumber("redeliveryMultiplier").doubleValue(),
|
||||
object.getJsonNumber("maxRedeliveryDelay").longValue(),
|
||||
object.getString("DLA"),
|
||||
object.getString("expiryAddress"),
|
||||
object.getBoolean("lastValueQueue"),
|
||||
object.getJsonNumber("redistributionDelay").longValue(),
|
||||
object.getBoolean("sendToDLAOnNoRoute"),
|
||||
object.getJsonNumber("slowConsumerThreshold").longValue(),
|
||||
object.getJsonNumber("slowConsumerCheckPeriod").longValue(),
|
||||
object.getString("slowConsumerPolicy"),
|
||||
object.getBoolean("autoCreateJmsQueues"),
|
||||
object.getBoolean("autoCreateJmsTopics"),
|
||||
object.getBoolean("autoDeleteJmsQueues"),
|
||||
object.getBoolean("autoDeleteJmsTopics"),
|
||||
object.getBoolean("autoCreateQueues"),
|
||||
object.getBoolean("autoDeleteQueues"),
|
||||
object.getBoolean("autoCreateAddresses"),
|
||||
object.getBoolean("autoDeleteAddresses"),
|
||||
object.getString("configDeleteQueues"),
|
||||
object.getString("configDeleteAddresses"),
|
||||
object.getJsonNumber("maxSizeBytesRejectThreshold").longValue(),
|
||||
object.getString("defaultLastValueKey"),
|
||||
object.getBoolean("defaultNonDestructive"),
|
||||
object.getBoolean("defaultExclusiveQueue"),
|
||||
object.getBoolean("defaultGroupRebalance"),
|
||||
object.getInt("defaultGroupBuckets"),
|
||||
object.getString("defaultGroupFirstKey"),
|
||||
object.getInt("defaultMaxConsumers"),
|
||||
object.getBoolean("defaultPurgeOnNoConsumers"),
|
||||
object.getInt("defaultConsumersBeforeDispatch"),
|
||||
object.getJsonNumber("defaultDelayBeforeDispatch").longValue(),
|
||||
object.getString("defaultQueueRoutingType"),
|
||||
object.getString("defaultAddressRoutingType"),
|
||||
object.getInt("defaultConsumerWindowSize"),
|
||||
object.getJsonNumber("defaultRingSize").longValue(),
|
||||
object.getBoolean("autoDeleteCreatedQueues"),
|
||||
object.getJsonNumber("autoDeleteQueuesDelay").longValue(),
|
||||
object.getJsonNumber("autoDeleteQueuesMessageCount").longValue(),
|
||||
object.getJsonNumber("autoDeleteAddressesDelay").longValue(),
|
||||
object.getJsonNumber("redeliveryCollisionAvoidanceFactor").doubleValue());
|
||||
}
|
||||
|
||||
// Constructors --------------------------------------------------
|
||||
|
@ -91,7 +188,33 @@ public final class AddressSettingsInfo {
|
|||
boolean autoCreateJmsQueues,
|
||||
boolean autoCreateJmsTopics,
|
||||
boolean autoDeleteJmsQueues,
|
||||
boolean autoDeleteJmsTopics) {
|
||||
boolean autoDeleteJmsTopics,
|
||||
boolean autoCreateQueues,
|
||||
boolean autoDeleteQueues,
|
||||
boolean autoCreateAddresses,
|
||||
boolean autoDeleteAddresses,
|
||||
String configDeleteQueues,
|
||||
String configDeleteAddresses,
|
||||
long maxSizeBytesRejectThreshold,
|
||||
String defaultLastValueKey,
|
||||
boolean defaultNonDestructive,
|
||||
boolean defaultExclusiveQueue,
|
||||
boolean defaultGroupRebalance,
|
||||
int defaultGroupBuckets,
|
||||
String defaultGroupFirstKey,
|
||||
int defaultMaxConsumers,
|
||||
boolean defaultPurgeOnNoConsumers,
|
||||
int defaultConsumersBeforeDispatch,
|
||||
long defaultDelayBeforeDispatch,
|
||||
String defaultQueueRoutingType,
|
||||
String defaultAddressRoutingType,
|
||||
int defaultConsumerWindowSize,
|
||||
long defaultRingSize,
|
||||
boolean autoDeleteCreatedQueues,
|
||||
long autoDeleteQueuesDelay,
|
||||
long autoDeleteQueuesMessageCount,
|
||||
long autoDeleteAddressesDelay,
|
||||
double redeliveryCollisionAvoidanceFactor) {
|
||||
this.addressFullMessagePolicy = addressFullMessagePolicy;
|
||||
this.maxSizeBytes = maxSizeBytes;
|
||||
this.pageSizeBytes = pageSizeBytes;
|
||||
|
@ -112,6 +235,32 @@ public final class AddressSettingsInfo {
|
|||
this.autoDeleteJmsQueues = autoDeleteJmsQueues;
|
||||
this.autoCreateJmsTopics = autoCreateJmsTopics;
|
||||
this.autoDeleteJmsTopics = autoDeleteJmsTopics;
|
||||
this.autoCreateQueues = autoCreateQueues;
|
||||
this.autoDeleteQueues = autoDeleteQueues;
|
||||
this.autoCreateAddresses = autoCreateAddresses;
|
||||
this.autoDeleteAddresses = autoDeleteAddresses;
|
||||
this.configDeleteQueues = configDeleteQueues;
|
||||
this.configDeleteAddresses = configDeleteAddresses;
|
||||
this.maxSizeBytesRejectThreshold = maxSizeBytesRejectThreshold;
|
||||
this.defaultLastValueKey = defaultLastValueKey;
|
||||
this.defaultNonDestructive = defaultNonDestructive;
|
||||
this.defaultExclusiveQueue = defaultExclusiveQueue;
|
||||
this.defaultGroupRebalance = defaultGroupRebalance;
|
||||
this.defaultGroupBuckets = defaultGroupBuckets;
|
||||
this.defaultGroupFirstKey = defaultGroupFirstKey;
|
||||
this.defaultMaxConsumers = defaultMaxConsumers;
|
||||
this.defaultPurgeOnNoConsumers = defaultPurgeOnNoConsumers;
|
||||
this.defaultConsumersBeforeDispatch = defaultConsumersBeforeDispatch;
|
||||
this.defaultDelayBeforeDispatch = defaultDelayBeforeDispatch;
|
||||
this.defaultQueueRoutingType = defaultQueueRoutingType;
|
||||
this.defaultAddressRoutingType = defaultAddressRoutingType;
|
||||
this.defaultConsumerWindowSize = defaultConsumerWindowSize;
|
||||
this.defaultRingSize = defaultRingSize;
|
||||
this.autoDeleteCreatedQueues = autoDeleteCreatedQueues;
|
||||
this.autoDeleteQueuesDelay = autoDeleteQueuesDelay;
|
||||
this.autoDeleteQueuesMessageCount = autoDeleteQueuesMessageCount;
|
||||
this.autoDeleteAddressesDelay = autoDeleteAddressesDelay;
|
||||
this.redeliveryCollisionAvoidanceFactor = redeliveryCollisionAvoidanceFactor;
|
||||
}
|
||||
|
||||
// Public --------------------------------------------------------
|
||||
|
@ -184,20 +333,128 @@ public final class AddressSettingsInfo {
|
|||
return slowConsumerPolicy;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isAutoCreateJmsQueues() {
|
||||
return autoCreateJmsQueues;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isAutoDeleteJmsQueues() {
|
||||
return autoDeleteJmsQueues;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isAutoCreateJmsTopics() {
|
||||
return autoCreateJmsTopics;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isAutoDeleteJmsTopics() {
|
||||
return autoDeleteJmsTopics;
|
||||
}
|
||||
|
||||
public boolean isAutoCreateQueues() {
|
||||
return autoCreateQueues;
|
||||
}
|
||||
|
||||
public boolean isAutoDeleteQueues() {
|
||||
return autoDeleteQueues;
|
||||
}
|
||||
|
||||
public boolean isAutoCreateAddresses() {
|
||||
return autoCreateAddresses;
|
||||
}
|
||||
|
||||
public boolean isAutoDeleteAddresses() {
|
||||
return autoDeleteAddresses;
|
||||
}
|
||||
|
||||
public String getConfigDeleteQueues() {
|
||||
return configDeleteQueues;
|
||||
}
|
||||
|
||||
public String getConfigDeleteAddresses() {
|
||||
return configDeleteAddresses;
|
||||
}
|
||||
|
||||
public long getMaxSizeBytesRejectThreshold() {
|
||||
return maxSizeBytesRejectThreshold;
|
||||
}
|
||||
|
||||
public String getDefaultLastValueKey() {
|
||||
return defaultLastValueKey;
|
||||
}
|
||||
|
||||
public boolean isDefaultNonDestructive() {
|
||||
return defaultNonDestructive;
|
||||
}
|
||||
|
||||
public boolean isDefaultExclusiveQueue() {
|
||||
return defaultExclusiveQueue;
|
||||
}
|
||||
|
||||
public boolean isDefaultGroupRebalance() {
|
||||
return defaultGroupRebalance;
|
||||
}
|
||||
|
||||
public int getDefaultGroupBuckets() {
|
||||
return defaultGroupBuckets;
|
||||
}
|
||||
|
||||
public String getDefaultGroupFirstKey() {
|
||||
return defaultGroupFirstKey;
|
||||
}
|
||||
|
||||
public int getDefaultMaxConsumers() {
|
||||
return defaultMaxConsumers;
|
||||
}
|
||||
|
||||
public boolean isDefaultPurgeOnNoConsumers() {
|
||||
return defaultPurgeOnNoConsumers;
|
||||
}
|
||||
|
||||
public int getDefaultConsumersBeforeDispatch() {
|
||||
return defaultConsumersBeforeDispatch;
|
||||
}
|
||||
|
||||
public long getDefaultDelayBeforeDispatch() {
|
||||
return defaultDelayBeforeDispatch;
|
||||
}
|
||||
|
||||
public String getDefaultQueueRoutingType() {
|
||||
return defaultQueueRoutingType;
|
||||
}
|
||||
|
||||
public String getDefaultAddressRoutingType() {
|
||||
return defaultAddressRoutingType;
|
||||
}
|
||||
|
||||
public int getDefaultConsumerWindowSize() {
|
||||
return defaultConsumerWindowSize;
|
||||
}
|
||||
|
||||
public long getDefaultRingSize() {
|
||||
return defaultRingSize;
|
||||
}
|
||||
|
||||
public boolean isAutoDeleteCreatedQueues() {
|
||||
return autoDeleteCreatedQueues;
|
||||
}
|
||||
|
||||
public long getAutoDeleteQueuesDelay() {
|
||||
return autoDeleteQueuesDelay;
|
||||
}
|
||||
|
||||
public long getAutoDeleteQueuesMessageCount() {
|
||||
return autoDeleteQueuesMessageCount;
|
||||
}
|
||||
|
||||
public long getAutoDeleteAddressesDelay() {
|
||||
return autoDeleteAddressesDelay;
|
||||
}
|
||||
|
||||
public double getRedeliveryCollisionAvoidanceFactor() {
|
||||
return redeliveryCollisionAvoidanceFactor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.apache.activemq.artemis.api.core.management;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -49,7 +50,33 @@ public class AddressSettingsInfoTest {
|
|||
"\"autoCreateJmsQueues\":true,\n" +
|
||||
"\"autoDeleteJmsQueues\":false,\n" +
|
||||
"\"autoCreateJmsTopics\":true,\n" +
|
||||
"\"autoDeleteJmsTopics\":false\n" +
|
||||
"\"autoDeleteJmsTopics\":false,\n" +
|
||||
"\"autoCreateQueues\":false,\n" +
|
||||
"\"autoDeleteQueues\":false,\n" +
|
||||
"\"autoCreateAddresses\":false,\n" +
|
||||
"\"autoDeleteAddresses\":false,\n" +
|
||||
"\"configDeleteQueues\":\"OFF\",\n" +
|
||||
"\"configDeleteAddresses\":\"FORCE\",\n" +
|
||||
"\"maxSizeBytesRejectThreshold\":1023,\n" +
|
||||
"\"defaultLastValueKey\":\"yyy\",\n" +
|
||||
"\"defaultNonDestructive\":false,\n" +
|
||||
"\"defaultExclusiveQueue\":false,\n" +
|
||||
"\"defaultGroupRebalance\":false,\n" +
|
||||
"\"defaultGroupBuckets\":1026,\n" +
|
||||
"\"defaultGroupFirstKey\":\"xxx\",\n" +
|
||||
"\"defaultMaxConsumers\":1001,\n" +
|
||||
"\"defaultPurgeOnNoConsumers\":false,\n" +
|
||||
"\"defaultConsumersBeforeDispatch\":1005,\n" +
|
||||
"\"defaultDelayBeforeDispatch\":1003,\n" +
|
||||
"\"defaultQueueRoutingType\":\"MULTICAST\",\n" +
|
||||
"\"defaultAddressRoutingType\":\"ANYCAST\",\n" +
|
||||
"\"defaultConsumerWindowSize\":2001,\n" +
|
||||
"\"defaultRingSize\":999,\n" +
|
||||
"\"autoDeleteCreatedQueues\":false,\n" +
|
||||
"\"autoDeleteQueuesDelay\":4,\n" +
|
||||
"\"autoDeleteQueuesMessageCount\":8,\n" +
|
||||
"\"autoDeleteAddressesDelay\":3003,\n" +
|
||||
"\"redeliveryCollisionAvoidanceFactor\":1.1\n" +
|
||||
"}";
|
||||
AddressSettingsInfo addressSettingsInfo = AddressSettingsInfo.from(json);
|
||||
assertEquals("fullPolicy", addressSettingsInfo.getAddressFullMessagePolicy());
|
||||
|
@ -72,6 +99,32 @@ public class AddressSettingsInfoTest {
|
|||
assertTrue(addressSettingsInfo.isAutoCreateJmsTopics());
|
||||
assertFalse(addressSettingsInfo.isAutoDeleteJmsQueues());
|
||||
assertFalse(addressSettingsInfo.isAutoDeleteJmsTopics());
|
||||
assertFalse(addressSettingsInfo.isAutoCreateQueues());
|
||||
assertFalse(addressSettingsInfo.isAutoDeleteQueues());
|
||||
assertFalse(addressSettingsInfo.isAutoCreateAddresses());
|
||||
assertFalse(addressSettingsInfo.isAutoDeleteAddresses());
|
||||
assertEquals("OFF", addressSettingsInfo.getConfigDeleteQueues());
|
||||
assertEquals("FORCE", addressSettingsInfo.getConfigDeleteAddresses());
|
||||
assertEquals(1023, addressSettingsInfo.getMaxSizeBytesRejectThreshold());
|
||||
assertEquals("yyy", addressSettingsInfo.getDefaultLastValueKey());
|
||||
assertFalse(addressSettingsInfo.isDefaultNonDestructive());
|
||||
assertFalse(addressSettingsInfo.isDefaultExclusiveQueue());
|
||||
assertFalse(addressSettingsInfo.isDefaultGroupRebalance());
|
||||
assertEquals(1026, addressSettingsInfo.getDefaultGroupBuckets());
|
||||
assertEquals("xxx", addressSettingsInfo.getDefaultGroupFirstKey());
|
||||
assertEquals(1001, addressSettingsInfo.getDefaultMaxConsumers());
|
||||
assertFalse(addressSettingsInfo.isDefaultPurgeOnNoConsumers());
|
||||
assertEquals(1005, addressSettingsInfo.getDefaultConsumersBeforeDispatch());
|
||||
assertEquals(1003, addressSettingsInfo.getDefaultDelayBeforeDispatch());
|
||||
assertEquals(RoutingType.MULTICAST.toString(), addressSettingsInfo.getDefaultQueueRoutingType());
|
||||
assertEquals(RoutingType.ANYCAST.toString(), addressSettingsInfo.getDefaultAddressRoutingType());
|
||||
assertEquals(2001, addressSettingsInfo.getDefaultConsumerWindowSize());
|
||||
assertEquals(999, addressSettingsInfo.getDefaultRingSize());
|
||||
assertFalse(addressSettingsInfo.isAutoDeleteCreatedQueues());
|
||||
assertEquals(4, addressSettingsInfo.getAutoDeleteQueuesDelay());
|
||||
assertEquals(8, addressSettingsInfo.getAutoDeleteQueuesMessageCount());
|
||||
assertEquals(3003, addressSettingsInfo.getAutoDeleteAddressesDelay());
|
||||
assertEquals(1.1, addressSettingsInfo.getRedeliveryCollisionAvoidanceFactor(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ import org.apache.activemq.artemis.api.core.JsonUtil;
|
|||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.api.core.SimpleString;
|
||||
import org.apache.activemq.artemis.api.core.TransportConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
|
||||
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
|
||||
import org.apache.activemq.artemis.api.core.management.AddressControl;
|
||||
import org.apache.activemq.artemis.api.core.management.BridgeControl;
|
||||
|
@ -112,6 +113,7 @@ import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
|||
import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
import org.apache.activemq.artemis.core.settings.impl.DeletionPolicy;
|
||||
import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
|
||||
import org.apache.activemq.artemis.core.transaction.ResourceManager;
|
||||
import org.apache.activemq.artemis.core.transaction.Transaction;
|
||||
|
@ -2721,13 +2723,35 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
.add("slowConsumerCheckPeriod", addressSettings.getSlowConsumerCheckPeriod())
|
||||
.add("slowConsumerPolicy", consumerPolicy)
|
||||
.add("autoCreateJmsQueues", addressSettings.isAutoCreateJmsQueues())
|
||||
.add("autoCreateJmsTopics", addressSettings.isAutoCreateJmsTopics())
|
||||
.add("autoDeleteJmsQueues", addressSettings.isAutoDeleteJmsQueues())
|
||||
.add("autoDeleteJmsTopics", addressSettings.isAutoDeleteJmsQueues())
|
||||
.add("autoCreateJmsTopics", addressSettings.isAutoCreateJmsTopics())
|
||||
.add("autoDeleteJmsTopics", addressSettings.isAutoDeleteJmsTopics())
|
||||
.add("autoCreateQueues", addressSettings.isAutoCreateQueues())
|
||||
.add("autoDeleteQueues", addressSettings.isAutoDeleteQueues())
|
||||
.add("autoCreateAddress", addressSettings.isAutoCreateAddresses())
|
||||
.add("autoDeleteAddress", addressSettings.isAutoDeleteAddresses())
|
||||
.add("autoCreateAddresses", addressSettings.isAutoCreateAddresses())
|
||||
.add("autoDeleteAddresses", addressSettings.isAutoDeleteAddresses())
|
||||
.add("configDeleteQueues", addressSettings.getConfigDeleteQueues().toString())
|
||||
.add("configDeleteAddresses", addressSettings.getConfigDeleteAddresses().toString())
|
||||
.add("maxSizeBytesRejectThreshold", addressSettings.getMaxSizeBytesRejectThreshold())
|
||||
.add("defaultLastValueKey", addressSettings.getDefaultLastValueKey() == null ? "" : addressSettings.getDefaultLastValueKey().toString())
|
||||
.add("defaultNonDestructive", addressSettings.isDefaultNonDestructive())
|
||||
.add("defaultExclusiveQueue", addressSettings.isDefaultExclusiveQueue())
|
||||
.add("defaultGroupRebalance", addressSettings.isDefaultGroupRebalance())
|
||||
.add("defaultGroupBuckets", addressSettings.getDefaultGroupBuckets())
|
||||
.add("defaultGroupFirstKey", addressSettings.getDefaultGroupFirstKey() == null ? "" : addressSettings.getDefaultGroupFirstKey().toString())
|
||||
.add("defaultMaxConsumers", addressSettings.getDefaultMaxConsumers())
|
||||
.add("defaultPurgeOnNoConsumers", addressSettings.isDefaultPurgeOnNoConsumers())
|
||||
.add("defaultConsumersBeforeDispatch", addressSettings.getDefaultConsumersBeforeDispatch())
|
||||
.add("defaultDelayBeforeDispatch", addressSettings.getDefaultDelayBeforeDispatch())
|
||||
.add("defaultQueueRoutingType", addressSettings.getDefaultQueueRoutingType().toString())
|
||||
.add("defaultAddressRoutingType", addressSettings.getDefaultAddressRoutingType().toString())
|
||||
.add("defaultConsumerWindowSize", addressSettings.getDefaultConsumerWindowSize())
|
||||
.add("defaultRingSize", addressSettings.getDefaultRingSize())
|
||||
.add("autoDeleteCreatedQueues", addressSettings.isAutoDeleteCreatedQueues())
|
||||
.add("autoDeleteQueuesDelay", addressSettings.getAutoDeleteQueuesDelay())
|
||||
.add("autoDeleteQueuesMessageCount", addressSettings.getAutoDeleteQueuesMessageCount())
|
||||
.add("autoDeleteAddressesDelay", addressSettings.getAutoDeleteAddressesDelay())
|
||||
.add("redeliveryCollisionAvoidanceFactor", addressSettings.getRedeliveryCollisionAvoidanceFactor())
|
||||
.build()
|
||||
.toString();
|
||||
}
|
||||
|
@ -2755,7 +2779,32 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
final boolean autoDeleteJmsQueues,
|
||||
final boolean autoCreateJmsTopics,
|
||||
final boolean autoDeleteJmsTopics) throws Exception {
|
||||
addAddressSettings(address, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics, AddressSettings.DEFAULT_AUTO_CREATE_QUEUES, AddressSettings.DEFAULT_AUTO_DELETE_QUEUES, AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES, AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES);
|
||||
addAddressSettings(address,
|
||||
DLA,
|
||||
expiryAddress,
|
||||
expiryDelay,
|
||||
lastValueQueue,
|
||||
deliveryAttempts,
|
||||
maxSizeBytes,
|
||||
pageSizeBytes,
|
||||
pageMaxCacheSize,
|
||||
redeliveryDelay,
|
||||
redeliveryMultiplier,
|
||||
maxRedeliveryDelay,
|
||||
redistributionDelay,
|
||||
sendToDLAOnNoRoute,
|
||||
addressFullMessagePolicy,
|
||||
slowConsumerThreshold,
|
||||
slowConsumerCheckPeriod,
|
||||
slowConsumerPolicy,
|
||||
autoCreateJmsQueues,
|
||||
autoDeleteJmsQueues,
|
||||
autoCreateJmsTopics,
|
||||
autoDeleteJmsTopics,
|
||||
AddressSettings.DEFAULT_AUTO_CREATE_QUEUES,
|
||||
AddressSettings.DEFAULT_AUTO_DELETE_QUEUES,
|
||||
AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES,
|
||||
AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2763,8 +2812,8 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
final String DLA,
|
||||
final String expiryAddress,
|
||||
final long expiryDelay,
|
||||
final boolean lastValueQueue,
|
||||
final int deliveryAttempts,
|
||||
final boolean defaultLastValueQueue,
|
||||
final int maxDeliveryAttempts,
|
||||
final long maxSizeBytes,
|
||||
final int pageSizeBytes,
|
||||
final int pageMaxCacheSize,
|
||||
|
@ -2785,13 +2834,117 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
final boolean autoDeleteQueues,
|
||||
final boolean autoCreateAddresses,
|
||||
final boolean autoDeleteAddresses) 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,
|
||||
AddressSettings.DEFAULT_CONFIG_DELETE_QUEUES.toString(),
|
||||
AddressSettings.DEFAULT_CONFIG_DELETE_ADDRESSES.toString(),
|
||||
AddressSettings.DEFAULT_ADDRESS_REJECT_THRESHOLD,
|
||||
ActiveMQDefaultConfiguration.getDefaultLastValueKey().toString(),
|
||||
ActiveMQDefaultConfiguration.getDefaultNonDestructive(),
|
||||
ActiveMQDefaultConfiguration.getDefaultExclusive(),
|
||||
ActiveMQDefaultConfiguration.getDefaultGroupRebalance(),
|
||||
ActiveMQDefaultConfiguration.getDefaultGroupBuckets(),
|
||||
ActiveMQDefaultConfiguration.getDefaultGroupFirstKey().toString(),
|
||||
ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(),
|
||||
ActiveMQDefaultConfiguration.getDefaultPurgeOnNoConsumers(),
|
||||
ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch(),
|
||||
ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch(),
|
||||
ActiveMQDefaultConfiguration.getDefaultRoutingType().toString(),
|
||||
ActiveMQDefaultConfiguration.getDefaultRoutingType().toString(),
|
||||
ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
|
||||
ActiveMQDefaultConfiguration.getDefaultRingSize(),
|
||||
AddressSettings.DEFAULT_AUTO_DELETE_CREATED_QUEUES,
|
||||
AddressSettings.DEFAULT_AUTO_DELETE_QUEUES_DELAY,
|
||||
AddressSettings.DEFAULT_AUTO_DELETE_QUEUES_MESSAGE_COUNT,
|
||||
AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES_DELAY,
|
||||
AddressSettings.DEFAULT_REDELIVER_COLLISION_AVOIDANCE_FACTOR);
|
||||
}
|
||||
|
||||
@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) throws Exception {
|
||||
if (AuditLogger.isEnabled()) {
|
||||
AuditLogger.addAddressSettings(this.server, address, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts,
|
||||
AuditLogger.addAddressSettings(this.server, 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);
|
||||
autoCreateAddresses, autoDeleteAddresses, configDeleteQueues, configDeleteAddresses, maxSizeBytesRejectThreshold,
|
||||
defaultLastValueKey, defaultNonDestructive, defaultExclusiveQueue, defaultGroupRebalance, defaultGroupBuckets,
|
||||
defaultGroupFirstKey, defaultMaxConsumers, defaultPurgeOnNoConsumers, defaultConsumersBeforeDispatch,
|
||||
defaultDelayBeforeDispatch, defaultQueueRoutingType, defaultAddressRoutingType, defaultConsumerWindowSize,
|
||||
defaultRingSize, autoDeleteCreatedQueues, autoDeleteQueuesDelay, autoDeleteQueuesMessageCount,
|
||||
autoDeleteAddressesDelay, redeliveryCollisionAvoidanceFactor);
|
||||
}
|
||||
checkStarted();
|
||||
|
||||
|
@ -2808,8 +2961,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.setDefaultLastValueQueue(lastValueQueue);
|
||||
addressSettings.setMaxDeliveryAttempts(deliveryAttempts);
|
||||
addressSettings.setDefaultLastValueQueue(defaultLastValueQueue);
|
||||
addressSettings.setMaxDeliveryAttempts(maxDeliveryAttempts);
|
||||
addressSettings.setPageCacheMaxSize(pageMaxCacheSize);
|
||||
addressSettings.setMaxSizeBytes(maxSizeBytes);
|
||||
addressSettings.setPageSizeBytes(pageSizeBytes);
|
||||
|
@ -2818,26 +2971,10 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
addressSettings.setMaxRedeliveryDelay(maxRedeliveryDelay);
|
||||
addressSettings.setRedistributionDelay(redistributionDelay);
|
||||
addressSettings.setSendToDLAOnNoRoute(sendToDLAOnNoRoute);
|
||||
if (addressFullMessagePolicy == null) {
|
||||
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
|
||||
} else if (addressFullMessagePolicy.equalsIgnoreCase("PAGE")) {
|
||||
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
|
||||
} else if (addressFullMessagePolicy.equalsIgnoreCase("DROP")) {
|
||||
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP);
|
||||
} else if (addressFullMessagePolicy.equalsIgnoreCase("BLOCK")) {
|
||||
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
|
||||
} else if (addressFullMessagePolicy.equalsIgnoreCase("FAIL")) {
|
||||
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL);
|
||||
}
|
||||
addressSettings.setAddressFullMessagePolicy(addressFullMessagePolicy == null ? AddressSettings.DEFAULT_ADDRESS_FULL_MESSAGE_POLICY : AddressFullMessagePolicy.valueOf(addressFullMessagePolicy.toUpperCase()));
|
||||
addressSettings.setSlowConsumerThreshold(slowConsumerThreshold);
|
||||
addressSettings.setSlowConsumerCheckPeriod(slowConsumerCheckPeriod);
|
||||
if (slowConsumerPolicy == null) {
|
||||
addressSettings.setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY);
|
||||
} else if (slowConsumerPolicy.equalsIgnoreCase("NOTIFY")) {
|
||||
addressSettings.setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY);
|
||||
} else if (slowConsumerPolicy.equalsIgnoreCase("KILL")) {
|
||||
addressSettings.setSlowConsumerPolicy(SlowConsumerPolicy.KILL);
|
||||
}
|
||||
addressSettings.setSlowConsumerPolicy(slowConsumerPolicy == null ? AddressSettings.DEFAULT_SLOW_CONSUMER_POLICY : SlowConsumerPolicy.valueOf(slowConsumerPolicy.toUpperCase()));
|
||||
addressSettings.setAutoCreateJmsQueues(autoCreateJmsQueues);
|
||||
addressSettings.setAutoDeleteJmsQueues(autoDeleteJmsQueues);
|
||||
addressSettings.setAutoCreateJmsTopics(autoCreateJmsTopics);
|
||||
|
@ -2846,6 +2983,29 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
addressSettings.setAutoDeleteQueues(autoDeleteQueues);
|
||||
addressSettings.setAutoCreateAddresses(autoCreateAddresses);
|
||||
addressSettings.setAutoDeleteAddresses(autoDeleteAddresses);
|
||||
addressSettings.setConfigDeleteQueues(configDeleteQueues == null ? AddressSettings.DEFAULT_CONFIG_DELETE_QUEUES : DeletionPolicy.valueOf(configDeleteQueues.toUpperCase()));
|
||||
addressSettings.setConfigDeleteAddresses(configDeleteAddresses == null ? AddressSettings.DEFAULT_CONFIG_DELETE_ADDRESSES : DeletionPolicy.valueOf(configDeleteAddresses.toUpperCase()));
|
||||
addressSettings.setMaxSizeBytesRejectThreshold(maxSizeBytesRejectThreshold);
|
||||
addressSettings.setDefaultLastValueKey(defaultLastValueKey == null ? ActiveMQDefaultConfiguration.getDefaultLastValueKey() : new SimpleString(defaultLastValueKey));
|
||||
addressSettings.setDefaultNonDestructive(defaultNonDestructive);
|
||||
addressSettings.setDefaultExclusiveQueue(defaultExclusiveQueue);
|
||||
addressSettings.setDefaultGroupRebalance(defaultGroupRebalance);
|
||||
addressSettings.setDefaultGroupBuckets(defaultGroupBuckets);
|
||||
addressSettings.setDefaultGroupFirstKey(defaultGroupFirstKey == null ? ActiveMQDefaultConfiguration.getDefaultGroupFirstKey() : new SimpleString(defaultGroupFirstKey));
|
||||
addressSettings.setDefaultMaxConsumers(defaultMaxConsumers);
|
||||
addressSettings.setDefaultPurgeOnNoConsumers(defaultPurgeOnNoConsumers);
|
||||
addressSettings.setDefaultConsumersBeforeDispatch(defaultConsumersBeforeDispatch);
|
||||
addressSettings.setDefaultDelayBeforeDispatch(defaultDelayBeforeDispatch);
|
||||
addressSettings.setDefaultQueueRoutingType(defaultQueueRoutingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : RoutingType.valueOf(defaultQueueRoutingType.toUpperCase()));
|
||||
addressSettings.setDefaultAddressRoutingType(defaultAddressRoutingType == null ? ActiveMQDefaultConfiguration.getDefaultRoutingType() : RoutingType.valueOf(defaultAddressRoutingType.toUpperCase()));
|
||||
addressSettings.setDefaultConsumerWindowSize(defaultConsumerWindowSize);
|
||||
addressSettings.setDefaultRingSize(defaultRingSize);
|
||||
addressSettings.setAutoDeleteCreatedQueues(autoDeleteCreatedQueues);
|
||||
addressSettings.setAutoDeleteQueuesDelay(autoDeleteQueuesDelay);
|
||||
addressSettings.setAutoDeleteQueuesMessageCount(autoDeleteQueuesMessageCount);
|
||||
addressSettings.setAutoDeleteAddressesDelay(autoDeleteAddressesDelay);
|
||||
addressSettings.setRedeliveryCollisionAvoidanceFactor(redeliveryCollisionAvoidanceFactor);
|
||||
|
||||
server.getAddressSettingsRepository().addMatch(address, addressSettings);
|
||||
|
||||
storageManager.storeAddressSetting(new PersistedAddressSetting(new SimpleString(address), addressSettings));
|
||||
|
|
|
@ -913,6 +913,9 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
if (defaultGroupBuckets == null) {
|
||||
defaultGroupBuckets = merged.defaultGroupBuckets;
|
||||
}
|
||||
if (defaultGroupFirstKey == null) {
|
||||
defaultGroupFirstKey = merged.defaultGroupFirstKey;
|
||||
}
|
||||
if (defaultRingSize == null) {
|
||||
defaultRingSize = merged.defaultRingSize;
|
||||
}
|
||||
|
@ -1080,6 +1083,10 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
if (buffer.readableBytes() > 0) {
|
||||
redeliveryCollisionAvoidanceFactor = BufferHelper.readNullableDouble(buffer);
|
||||
}
|
||||
|
||||
if (buffer.readableBytes() > 0) {
|
||||
defaultGroupFirstKey = buffer.readNullableSimpleString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1129,6 +1136,7 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
BufferHelper.sizeOfNullableLong(autoDeleteAddressesDelay) +
|
||||
BufferHelper.sizeOfNullableBoolean(defaultGroupRebalance) +
|
||||
BufferHelper.sizeOfNullableInteger(defaultGroupBuckets) +
|
||||
SimpleString.sizeofNullableString(defaultGroupFirstKey) +
|
||||
BufferHelper.sizeOfNullableLong(autoDeleteQueuesMessageCount) +
|
||||
BufferHelper.sizeOfNullableBoolean(autoDeleteCreatedQueues) +
|
||||
BufferHelper.sizeOfNullableLong(defaultRingSize);
|
||||
|
@ -1234,6 +1242,7 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
|
||||
BufferHelper.writeNullableDouble(buffer, redeliveryCollisionAvoidanceFactor);
|
||||
|
||||
buffer.writeNullableSimpleString(defaultGroupFirstKey);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1292,6 +1301,7 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
result = prime * result + ((defaultConsumerWindowSize == null) ? 0 : defaultConsumerWindowSize.hashCode());
|
||||
result = prime * result + ((defaultGroupRebalance == null) ? 0 : defaultGroupRebalance.hashCode());
|
||||
result = prime * result + ((defaultGroupBuckets == null) ? 0 : defaultGroupBuckets.hashCode());
|
||||
result = prime * result + ((defaultGroupFirstKey == null) ? 0 : defaultGroupFirstKey.hashCode());
|
||||
result = prime * result + ((defaultRingSize == null) ? 0 : defaultRingSize.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
@ -1564,6 +1574,12 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
} else if (!defaultGroupBuckets.equals(other.defaultGroupBuckets))
|
||||
return false;
|
||||
|
||||
if (defaultGroupFirstKey == null) {
|
||||
if (other.defaultGroupFirstKey != null)
|
||||
return false;
|
||||
} else if (!defaultGroupFirstKey.equals(other.defaultGroupFirstKey))
|
||||
return false;
|
||||
|
||||
if (defaultRingSize == null) {
|
||||
if (other.defaultRingSize != null)
|
||||
return false;
|
||||
|
@ -1672,6 +1688,8 @@ public class AddressSettings implements Mergeable<AddressSettings>, Serializable
|
|||
defaultGroupRebalance +
|
||||
", defaultGroupBuckets=" +
|
||||
defaultGroupBuckets +
|
||||
", defaultGroupFirstKey=" +
|
||||
defaultGroupFirstKey +
|
||||
", defaultRingSize=" +
|
||||
defaultRingSize +
|
||||
"]";
|
||||
|
|
|
@ -18,4 +18,15 @@ package org.apache.activemq.artemis.core.settings.impl;
|
|||
|
||||
public enum DeletionPolicy {
|
||||
OFF, FORCE;
|
||||
|
||||
public static DeletionPolicy getType(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return OFF;
|
||||
case 1:
|
||||
return FORCE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,15 @@ package org.apache.activemq.artemis.core.settings.impl;
|
|||
|
||||
public enum SlowConsumerPolicy {
|
||||
KILL, NOTIFY;
|
||||
|
||||
public static SlowConsumerPolicy getType(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
return KILL;
|
||||
case 1:
|
||||
return NOTIFY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3278,7 +3278,8 @@
|
|||
<xsd:element name="auto-delete-queues-message-count" type="xsd:long" default="0" maxOccurs="1" minOccurs="0">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
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. </xsd:documentation>
|
||||
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.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
|
|
|
@ -583,7 +583,8 @@ that would be found in the `broker.xml` file.
|
|||
<address-full-policy>PAGE</address-full-policy>
|
||||
<message-counter-history-day-limit></message-counter-history-day-limit>
|
||||
<last-value-queue>true</last-value-queue> <!-- deprecated! see default-last-value-queue -->
|
||||
<default-last-value-queue>true</default-last-value-queue>
|
||||
<default-last-value-queue>false</default-last-value-queue>
|
||||
<default-non-destructive>false</default-non-destructive>
|
||||
<default-exclusive-queue>false</default-exclusive-queue>
|
||||
<default-consumers-before-dispatch>0</default-consumers-before-dispatch>
|
||||
<default-delay-before-dispatch>-1</default-delay-before-dispatch>
|
||||
|
|
|
@ -218,7 +218,9 @@ Name | Description | Default
|
|||
[message-counter-history-day-limit](address-model.md) | Days to keep message counter data | 0
|
||||
[last-value-queue](last-value-queues.md) | **deprecated** Queue is a last value queue; see `default-last-value-queue` instead | `false`
|
||||
[default-last-value-queue](last-value-queues.md)| `last-value` value if none is set on the queue | `false`
|
||||
[default-last-value-key](last-value-queues.md)| `last-value-key` value if none is set on the queue | `null`
|
||||
[default-exclusive-queue](exclusive-queues.md) | `exclusive` value if none is set on the queue | `false`
|
||||
[default-non-destructive](exclusive-queues.md) | `non-destructive` value if none is set on the queue | `false`
|
||||
[default-consumers-before-dispatch](exclusive-queues.md) | `consumers-before-dispatch` value if none is set on the queue | 0
|
||||
[default-delay-before-dispatch](exclusive-queues.md) | `delay-before-dispatch` value if none is set on the queue | -1
|
||||
[redistribution-delay](clusters.md) | Timeout before redistributing values after no consumers | -1
|
||||
|
@ -234,6 +236,7 @@ Name | Description | Default
|
|||
[auto-delete-queues](address-model.md#configuring-addresses-and-queues-via-address-settings) | Delete auto-created queues automatically | `true`
|
||||
[auto-delete-created-queues](address-model.md#configuring-addresses-and-queues-via-address-settings) | Delete created queues automatically | `false`
|
||||
[auto-delete-queues-delay](address-model.md#configuring-addresses-and-queues-via-address-settings) | Delay for deleting auto-created queues | 0
|
||||
[auto-delete-queues-message-count](address-model.md#configuring-addresses-and-queues-via-address-settings) | Message count the queue must be at or below before it can be auto deleted | 0
|
||||
[config-delete-queues](config-reload.md)| How to deal with queues deleted from XML at runtime| `OFF`
|
||||
[auto-create-addresses](address-model.md#configuring-addresses-and-queues-via-address-settings) | Create addresses automatically | `true`
|
||||
[auto-delete-addresses](address-model.md#configuring-addresses-and-queues-via-address-settings) | Delete auto-created addresses automatically | `true`
|
||||
|
|
|
@ -69,6 +69,7 @@ import org.apache.activemq.artemis.api.core.RoutingType;
|
|||
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
||||
import org.apache.activemq.artemis.core.server.ServerSession;
|
||||
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
|
||||
import org.apache.activemq.artemis.core.settings.impl.DeletionPolicy;
|
||||
import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
|
||||
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
|
||||
import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext;
|
||||
|
@ -721,23 +722,144 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
|
|||
String addressFullMessagePolicy = "PAGE";
|
||||
long slowConsumerThreshold = 5;
|
||||
long slowConsumerCheckPeriod = 10;
|
||||
String slowConsumerPolicy = SlowConsumerPolicy.KILL.toString();
|
||||
boolean autoCreateJmsQueues = false;
|
||||
boolean autoDeleteJmsQueues = false;
|
||||
boolean autoCreateJmsTopics = false;
|
||||
boolean autoDeleteJmsTopics = false;
|
||||
String slowConsumerPolicy = SlowConsumerPolicy.getType(RandomUtil.randomPositiveInt() % 2).toString();
|
||||
boolean autoCreateJmsQueues = RandomUtil.randomBoolean();
|
||||
boolean autoDeleteJmsQueues = RandomUtil.randomBoolean();
|
||||
boolean autoCreateJmsTopics = RandomUtil.randomBoolean();
|
||||
boolean autoDeleteJmsTopics = RandomUtil.randomBoolean();
|
||||
|
||||
serverControl.addAddressSettings(addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics);
|
||||
boolean autoCreateQueues = RandomUtil.randomBoolean();
|
||||
boolean autoDeleteQueues = RandomUtil.randomBoolean();
|
||||
boolean autoCreateAddresses = RandomUtil.randomBoolean();
|
||||
boolean autoDeleteAddresses = RandomUtil.randomBoolean();
|
||||
String configDeleteQueues = DeletionPolicy.getType(RandomUtil.randomPositiveInt() % 2).toString();
|
||||
String configDeleteAddresses = DeletionPolicy.getType(RandomUtil.randomPositiveInt() % 2).toString();
|
||||
long maxSizeBytesRejectThreshold = RandomUtil.randomPositiveLong();
|
||||
String defaultLastValueKey = RandomUtil.randomString();
|
||||
boolean defaultNonDestructive = RandomUtil.randomBoolean();
|
||||
boolean defaultExclusiveQueue = RandomUtil.randomBoolean();
|
||||
boolean defaultGroupRebalance = RandomUtil.randomBoolean();
|
||||
int defaultGroupBuckets = RandomUtil.randomPositiveInt();
|
||||
String defaultGroupFirstKey = RandomUtil.randomString();
|
||||
int defaultMaxConsumers = RandomUtil.randomPositiveInt();
|
||||
boolean defaultPurgeOnNoConsumers = RandomUtil.randomBoolean();
|
||||
int defaultConsumersBeforeDispatch = RandomUtil.randomPositiveInt();
|
||||
long defaultDelayBeforeDispatch = RandomUtil.randomPositiveLong();
|
||||
String defaultQueueRoutingType = RoutingType.getType((byte) (RandomUtil.randomPositiveInt() % 2)).toString();
|
||||
String defaultAddressRoutingType = RoutingType.getType((byte) (RandomUtil.randomPositiveInt() % 2)).toString();
|
||||
int defaultConsumerWindowSize = RandomUtil.randomPositiveInt();
|
||||
long defaultRingSize = RandomUtil.randomPositiveLong();
|
||||
boolean autoDeleteCreatedQueues = RandomUtil.randomBoolean();
|
||||
long autoDeleteQueuesDelay = RandomUtil.randomPositiveLong();
|
||||
long autoDeleteQueuesMessageCount = RandomUtil.randomPositiveLong();
|
||||
long autoDeleteAddressesDelay = RandomUtil.randomPositiveLong();
|
||||
double redeliveryCollisionAvoidanceFactor = RandomUtil.randomDouble();
|
||||
|
||||
serverControl.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);
|
||||
|
||||
boolean ex = false;
|
||||
try {
|
||||
serverControl.addAddressSettings(addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, 100, 1000, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics);
|
||||
serverControl.addAddressSettings(addressMatch,
|
||||
DLA,
|
||||
expiryAddress,
|
||||
expiryDelay,
|
||||
lastValueQueue,
|
||||
deliveryAttempts,
|
||||
100,
|
||||
1000,
|
||||
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);
|
||||
} catch (Exception expected) {
|
||||
ex = true;
|
||||
}
|
||||
|
||||
assertTrue("Exception expected", ex);
|
||||
//restartServer();
|
||||
restartServer();
|
||||
serverControl = createManagementControl();
|
||||
|
||||
String jsonString = serverControl.getAddressSettingsAsJSON(exactAddress);
|
||||
|
@ -761,10 +883,83 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
|
|||
assertEquals(slowConsumerPolicy, info.getSlowConsumerPolicy());
|
||||
assertEquals(autoCreateJmsQueues, info.isAutoCreateJmsQueues());
|
||||
assertEquals(autoDeleteJmsQueues, info.isAutoDeleteJmsQueues());
|
||||
// assertEquals(autoCreateJmsTopics, info.isAutoCreateAddresses());
|
||||
assertEquals(autoCreateJmsTopics, info.isAutoCreateJmsTopics());
|
||||
assertEquals(autoDeleteJmsTopics, info.isAutoDeleteJmsTopics());
|
||||
assertEquals(autoCreateQueues, info.isAutoCreateQueues());
|
||||
assertEquals(autoDeleteQueues, info.isAutoDeleteQueues());
|
||||
assertEquals(autoCreateAddresses, info.isAutoCreateAddresses());
|
||||
assertEquals(autoDeleteAddresses, info.isAutoDeleteAddresses());
|
||||
assertEquals(configDeleteQueues, info.getConfigDeleteQueues());
|
||||
assertEquals(configDeleteAddresses, info.getConfigDeleteAddresses());
|
||||
assertEquals(maxSizeBytesRejectThreshold, info.getMaxSizeBytesRejectThreshold());
|
||||
assertEquals(defaultLastValueKey, info.getDefaultLastValueKey());
|
||||
assertEquals(defaultNonDestructive, info.isDefaultNonDestructive());
|
||||
assertEquals(defaultExclusiveQueue, info.isDefaultExclusiveQueue());
|
||||
assertEquals(defaultGroupRebalance, info.isDefaultGroupRebalance());
|
||||
assertEquals(defaultGroupBuckets, info.getDefaultGroupBuckets());
|
||||
assertEquals(defaultGroupFirstKey, info.getDefaultGroupFirstKey());
|
||||
assertEquals(defaultMaxConsumers, info.getDefaultMaxConsumers());
|
||||
assertEquals(defaultPurgeOnNoConsumers, info.isDefaultPurgeOnNoConsumers());
|
||||
assertEquals(defaultConsumersBeforeDispatch, info.getDefaultConsumersBeforeDispatch());
|
||||
assertEquals(defaultDelayBeforeDispatch, info.getDefaultDelayBeforeDispatch());
|
||||
assertEquals(defaultQueueRoutingType, info.getDefaultQueueRoutingType());
|
||||
assertEquals(defaultAddressRoutingType, info.getDefaultAddressRoutingType());
|
||||
assertEquals(defaultConsumerWindowSize, info.getDefaultConsumerWindowSize());
|
||||
assertEquals(defaultRingSize, info.getDefaultRingSize());
|
||||
assertEquals(autoDeleteCreatedQueues, info.isAutoDeleteCreatedQueues());
|
||||
assertEquals(autoDeleteQueuesDelay, info.getAutoDeleteQueuesDelay());
|
||||
assertEquals(autoDeleteQueuesMessageCount, info.getAutoDeleteQueuesMessageCount());
|
||||
assertEquals(autoDeleteAddressesDelay, info.getAutoDeleteAddressesDelay());
|
||||
assertEquals(redeliveryCollisionAvoidanceFactor, info.getRedeliveryCollisionAvoidanceFactor(), 0);
|
||||
|
||||
serverControl.addAddressSettings(addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, -1, 1000, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics);
|
||||
serverControl.addAddressSettings(addressMatch,
|
||||
DLA,
|
||||
expiryAddress,
|
||||
expiryDelay,
|
||||
lastValueQueue,
|
||||
deliveryAttempts,
|
||||
-1,
|
||||
1000,
|
||||
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);
|
||||
|
||||
jsonString = serverControl.getAddressSettingsAsJSON(exactAddress);
|
||||
info = AddressSettingsInfo.from(jsonString);
|
||||
|
@ -787,12 +982,85 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
|
|||
assertEquals(slowConsumerPolicy, info.getSlowConsumerPolicy());
|
||||
assertEquals(autoCreateJmsQueues, info.isAutoCreateJmsQueues());
|
||||
assertEquals(autoDeleteJmsQueues, info.isAutoDeleteJmsQueues());
|
||||
// assertEquals(autoCreateJmsTopics, info.isAutoCreateAddresses());
|
||||
assertEquals(autoCreateJmsTopics, info.isAutoCreateJmsTopics());
|
||||
assertEquals(autoDeleteJmsTopics, info.isAutoDeleteJmsTopics());
|
||||
assertEquals(autoCreateQueues, info.isAutoCreateQueues());
|
||||
assertEquals(autoDeleteQueues, info.isAutoDeleteQueues());
|
||||
assertEquals(autoCreateAddresses, info.isAutoCreateAddresses());
|
||||
assertEquals(autoDeleteAddresses, info.isAutoDeleteAddresses());
|
||||
assertEquals(configDeleteQueues, info.getConfigDeleteQueues());
|
||||
assertEquals(configDeleteAddresses, info.getConfigDeleteAddresses());
|
||||
assertEquals(maxSizeBytesRejectThreshold, info.getMaxSizeBytesRejectThreshold());
|
||||
assertEquals(defaultLastValueKey, info.getDefaultLastValueKey());
|
||||
assertEquals(defaultNonDestructive, info.isDefaultNonDestructive());
|
||||
assertEquals(defaultExclusiveQueue, info.isDefaultExclusiveQueue());
|
||||
assertEquals(defaultGroupRebalance, info.isDefaultGroupRebalance());
|
||||
assertEquals(defaultGroupBuckets, info.getDefaultGroupBuckets());
|
||||
assertEquals(defaultGroupFirstKey, info.getDefaultGroupFirstKey());
|
||||
assertEquals(defaultMaxConsumers, info.getDefaultMaxConsumers());
|
||||
assertEquals(defaultPurgeOnNoConsumers, info.isDefaultPurgeOnNoConsumers());
|
||||
assertEquals(defaultConsumersBeforeDispatch, info.getDefaultConsumersBeforeDispatch());
|
||||
assertEquals(defaultDelayBeforeDispatch, info.getDefaultDelayBeforeDispatch());
|
||||
assertEquals(defaultQueueRoutingType, info.getDefaultQueueRoutingType());
|
||||
assertEquals(defaultAddressRoutingType, info.getDefaultAddressRoutingType());
|
||||
assertEquals(defaultConsumerWindowSize, info.getDefaultConsumerWindowSize());
|
||||
assertEquals(defaultRingSize, info.getDefaultRingSize());
|
||||
assertEquals(autoDeleteCreatedQueues, info.isAutoDeleteCreatedQueues());
|
||||
assertEquals(autoDeleteQueuesDelay, info.getAutoDeleteQueuesDelay());
|
||||
assertEquals(autoDeleteQueuesMessageCount, info.getAutoDeleteQueuesMessageCount());
|
||||
assertEquals(autoDeleteAddressesDelay, info.getAutoDeleteAddressesDelay());
|
||||
assertEquals(redeliveryCollisionAvoidanceFactor, info.getRedeliveryCollisionAvoidanceFactor(), 0);
|
||||
|
||||
ex = false;
|
||||
try {
|
||||
serverControl.addAddressSettings(addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, -2, 1000, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics);
|
||||
serverControl.addAddressSettings(addressMatch,
|
||||
DLA,
|
||||
expiryAddress,
|
||||
expiryDelay,
|
||||
lastValueQueue,
|
||||
deliveryAttempts,
|
||||
-2,
|
||||
1000,
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
ex = true;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.activemq.artemis.api.core.ActiveMQAddressDoesNotExistException
|
|||
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
|
||||
import org.apache.activemq.artemis.api.core.management.Parameter;
|
||||
import org.apache.activemq.artemis.api.core.management.ResourceNames;
|
||||
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
|
||||
|
||||
public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTest {
|
||||
|
||||
|
@ -826,7 +825,29 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
|
|||
@Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues,
|
||||
@Parameter(desc = "allow topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics,
|
||||
@Parameter(desc = "allow auto-created topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics) throws Exception {
|
||||
addAddressSettings(addressMatch, DLA, expiryAddress, expiryDelay, lastValueQueue, deliveryAttempts, maxSizeBytes, pageSizeBytes, pageMaxCacheSize, redeliveryDelay, redeliveryMultiplier, maxRedeliveryDelay, redistributionDelay, sendToDLAOnNoRoute, addressFullMessagePolicy, slowConsumerThreshold, slowConsumerCheckPeriod, slowConsumerPolicy, autoCreateJmsQueues, autoDeleteJmsQueues, autoCreateJmsTopics, autoDeleteJmsTopics, AddressSettings.DEFAULT_AUTO_CREATE_QUEUES, AddressSettings.DEFAULT_AUTO_DELETE_QUEUES, AddressSettings.DEFAULT_AUTO_CREATE_ADDRESSES, AddressSettings.DEFAULT_AUTO_DELETE_ADDRESSES);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -856,7 +877,133 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
|
|||
@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) 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);
|
||||
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);
|
||||
}
|
||||
|
||||
@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) 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue