This closes #3237
This commit is contained in:
commit
3c3b7b66cf
|
@ -39,7 +39,7 @@ public class QueueConfigurationUtils {
|
|||
config.setPurgeOnNoConsumers(config.isPurgeOnNoConsumers() == null ? as.isDefaultPurgeOnNoConsumers() : config.isPurgeOnNoConsumers());
|
||||
config.setAutoCreateAddress(config.isAutoCreateAddress() == null ? as.isAutoCreateAddresses() : config.isAutoCreateAddress());
|
||||
// set the default auto-delete
|
||||
config.setAutoDelete(config.isAutoDelete() == null ? (config.isAutoCreated() && as.isAutoDeleteQueues()) || (!config.isAutoCreated() && as.isAutoDeleteCreatedQueues()) : config.isAutoDelete());
|
||||
config.setAutoDelete(config.isAutoDelete() == null ? !config.isConfigurationManaged() && ((config.isAutoCreated() && as.isAutoDeleteQueues()) || (!config.isAutoCreated() && as.isAutoDeleteCreatedQueues())) : config.isAutoDelete());
|
||||
|
||||
config.setAutoDeleteDelay(config.getAutoDeleteDelay() == null ? as.getAutoDeleteQueuesDelay() : config.getAutoDeleteDelay());
|
||||
config.setAutoDeleteMessageCount(config.getAutoDeleteMessageCount() == null ? as.getAutoDeleteQueuesMessageCount() : config.getAutoDeleteMessageCount());
|
||||
|
|
|
@ -32,6 +32,7 @@ public class AutoDeleteCreatedQueueTest extends ActiveMQTestBase {
|
|||
|
||||
public final SimpleString addressA = new SimpleString("addressA");
|
||||
public final SimpleString queueA = new SimpleString("queueA");
|
||||
public final SimpleString queueConfigurationManaged = new SimpleString("queueConfigurationManaged");
|
||||
|
||||
private ServerLocator locator;
|
||||
private ActiveMQServer server;
|
||||
|
@ -59,4 +60,23 @@ public class AutoDeleteCreatedQueueTest extends ActiveMQTestBase {
|
|||
cf.createSession().createConsumer(queueA).close();
|
||||
Wait.assertTrue(() -> server.locateQueue(queueA) == null);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAutoDeleteCreatedQueueDoesNOTDeleteConfigurationManagedQueuesOnLastConsumerClose() throws Exception {
|
||||
server.getAddressSettingsRepository().addMatch(addressA.toString(), new AddressSettings().setAutoDeleteCreatedQueues(true));
|
||||
|
||||
server.createQueue(new QueueConfiguration(queueA).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).setAutoCreated(false));
|
||||
server.createQueue(new QueueConfiguration(queueConfigurationManaged).setAddress(addressA).setRoutingType(RoutingType.MULTICAST).setAutoCreated(false).setConfigurationManaged(true));
|
||||
assertNotNull(server.locateQueue(queueA));
|
||||
assertNotNull(server.locateQueue(queueConfigurationManaged));
|
||||
assertTrue(server.locateQueue(queueA).isAutoDelete());
|
||||
assertFalse(server.locateQueue(queueConfigurationManaged).isAutoDelete());
|
||||
cf.createSession().createConsumer(queueA).close();
|
||||
cf.createSession().createConsumer(queueConfigurationManaged).close();
|
||||
//Make sure the reaper has run by checking the queueA should be removed.
|
||||
Wait.assertTrue(() -> server.locateQueue(queueA) == null);
|
||||
//Check that our configuration managed queue is not removed.
|
||||
assertNotNull(server.locateQueue(queueConfigurationManaged));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue