This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 83e2595  ARTEMIS-2534 Deleting addresses auto created on configuration 
reload
     new 367f18b  This closes #2878
83e2595 is described below

commit 83e2595618622ff19b91c80890e9f6566f6a5b4b
Author: brusdev <[email protected]>
AuthorDate: Wed Oct 30 16:30:27 2019 +0100

    ARTEMIS-2534 Deleting addresses auto created on configuration reload
    
    Skip the deletion of address's and queue's auto created on configuration
    reload.
---
 .../apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java  | 4 +++-
 .../apache/activemq/artemis/tests/integration/jms/RedeployTest.java   | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 3628675..25486c4 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -3014,9 +3014,11 @@ public class ActiveMQServerImpl implements 
ActiveMQServer {
               .collect(Collectors.toSet());
 
       for (SimpleString addressName : listAddressNames()) {
+         AddressInfo addressInfo = getAddressInfo(addressName);
          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)) {
                ActiveMQServerLogger.LOGGER.undeployQueue(queue.getName());
                try {
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java
index e94f12b..cb9dca4 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/RedeployTest.java
@@ -84,6 +84,8 @@ public class RedeployTest extends ActiveMQTestBase {
          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
       embeddedActiveMQ.getActiveMQServer().getPostOffice().addBinding(new 
RemoteQueueBindingImpl(5L,
               new SimpleString("autoQueue"),
@@ -117,6 +119,8 @@ public class RedeployTest extends ActiveMQTestBase {
 
          Assert.assertTrue(tryConsume());
 
+         Assert.assertNotNull(getQueue(embeddedActiveMQ, "autoQueue"));
+
          factory = new ActiveMQConnectionFactory();
          try (Connection connection = factory.createConnection()) {
             Session session = connection.createSession();

Reply via email to