ARTEMIS-2534 Deleting addresses auto created on configuration reload

Skip the deletion of address's and queue's auto created on configuration
reload.
This commit is contained in:
brusdev 2019-10-30 16:30:27 +01:00 committed by Clebert Suconic
parent 8c7f120e0a
commit 83e2595618
2 changed files with 7 additions and 1 deletions

View File

@ -3014,9 +3014,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
for (SimpleString addressName : listAddressNames()) { for (SimpleString addressName : listAddressNames()) {
AddressInfo addressInfo = getAddressInfo(addressName);
AddressSettings addressSettings = getAddressSettingsRepository().getMatch(addressName.toString()); AddressSettings addressSettings = getAddressSettingsRepository().getMatch(addressName.toString());
if (!addressesInConfig.contains(addressName.toString()) && addressSettings.getConfigDeleteAddresses() == DeletionPolicy.FORCE) { if (!addressesInConfig.contains(addressName.toString()) && addressInfo != null && !addressInfo.isAutoCreated() &&
addressSettings.getConfigDeleteAddresses() == DeletionPolicy.FORCE) {
for (Queue queue : listQueues(addressName)) { for (Queue queue : listQueues(addressName)) {
ActiveMQServerLogger.LOGGER.undeployQueue(queue.getName()); ActiveMQServerLogger.LOGGER.undeployQueue(queue.getName());
try { try {

View File

@ -84,6 +84,8 @@ public class RedeployTest extends ActiveMQTestBase {
Assert.assertNotNull("Address wasn't autocreated accordingly", consumer.receive(5000)); Assert.assertNotNull("Address wasn't autocreated accordingly", consumer.receive(5000));
} }
Assert.assertNotNull(getQueue(embeddedActiveMQ, "autoQueue"));
// this simulates a remote queue or other type being added that wouldnt get deleted, its not valid to have this happen but it can happen when addresses and queues are auto created in a clustered env // this simulates a remote queue or other type being added that wouldnt get deleted, its not valid to have this happen but it can happen when addresses and queues are auto created in a clustered env
embeddedActiveMQ.getActiveMQServer().getPostOffice().addBinding(new RemoteQueueBindingImpl(5L, embeddedActiveMQ.getActiveMQServer().getPostOffice().addBinding(new RemoteQueueBindingImpl(5L,
new SimpleString("autoQueue"), new SimpleString("autoQueue"),
@ -117,6 +119,8 @@ public class RedeployTest extends ActiveMQTestBase {
Assert.assertTrue(tryConsume()); Assert.assertTrue(tryConsume());
Assert.assertNotNull(getQueue(embeddedActiveMQ, "autoQueue"));
factory = new ActiveMQConnectionFactory(); factory = new ActiveMQConnectionFactory();
try (Connection connection = factory.createConnection()) { try (Connection connection = factory.createConnection()) {
Session session = connection.createSession(); Session session = connection.createSession();