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

michaelpearce 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 369c429  ARTEMIS-2292 - Fix queue level auto-delete for topic 
subscription queue
     new d72e6e4  This closes #2604
369c429 is described below

commit 369c429d8a64fa952c4c3a5f4673606665110224
Author: Michael André Pearce <michael.andre.pea...@me.com>
AuthorDate: Tue Apr 2 19:04:43 2019 +0100

    ARTEMIS-2292 - Fix queue level auto-delete for topic subscription queue
    
    Adjust auto-delete defaults based on if queue autocreated
---
 .../artemis/api/config/ActiveMQDefaultConfiguration.java       | 10 ++++++++++
 .../impl/journal/codec/PersistentQueueBindingEncoding.java     |  2 +-
 .../org/apache/activemq/artemis/core/server/QueueConfig.java   |  2 +-
 .../activemq/artemis/core/server/impl/QueueFactoryImpl.java    |  2 +-
 .../apache/activemq/artemis/core/server/impl/QueueImpl.java    |  2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
index acd586d..7ea952b 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
@@ -509,6 +509,8 @@ public final class ActiveMQDefaultConfiguration {
 
    public static final boolean DEFAULT_QUEUE_AUTO_DELETE = true;
 
+   public static final boolean DEFAULT_CREATED_QUEUE_AUTO_DELETE = false;
+
    public static final long DEFAULT_QUEUE_AUTO_DELETE_DELAY = 0;
 
    public static final long DEFAULT_QUEUE_AUTO_DELETE_MESSAGE_COUNT = 0;
@@ -1392,10 +1394,18 @@ public final class ActiveMQDefaultConfiguration {
       return DEFAULT_PURGE_ON_NO_CONSUMERS;
    }
 
+   public static boolean getDefaultQueueAutoDelete(boolean autoCreated) {
+      return autoCreated ? getDefaultQueueAutoDelete() : 
getDefaultCreatedQueueAutoDelete();
+   }
+
    public static boolean getDefaultQueueAutoDelete() {
       return DEFAULT_QUEUE_AUTO_DELETE;
    }
 
+   public static boolean getDefaultCreatedQueueAutoDelete() {
+      return DEFAULT_CREATED_QUEUE_AUTO_DELETE;
+   }
+
    public static long getDefaultQueueAutoDeleteDelay() {
       return DEFAULT_QUEUE_AUTO_DELETE_DELAY;
    }
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
index b72ad7f..1e104c1 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/codec/PersistentQueueBindingEncoding.java
@@ -419,7 +419,7 @@ public class PersistentQueueBindingEncoding implements 
EncodingSupport, QueueBin
       if (buffer.readableBytes() > 0) {
          autoDelete = buffer.readBoolean();
       } else {
-         autoDelete = ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete();
+         autoDelete = 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated);
       }
       if (buffer.readableBytes() > 0) {
          autoDeleteDelay = buffer.readLong();
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
index ebf332d..0d8e4da 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java
@@ -104,7 +104,7 @@ public final class QueueConfig {
          this.delayBeforeDispatch = 
ActiveMQDefaultConfiguration.getDefaultDelayBeforeDispatch();
          this.groupRebalance = 
ActiveMQDefaultConfiguration.getDefaultGroupRebalance();
          this.groupBuckets = 
ActiveMQDefaultConfiguration.getDefaultGroupBuckets();
-         this.autoDelete = 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete();
+         this.autoDelete = 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated);
          this.autoDeleteDelay = 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteDelay();
          this.autoDeleteMessageCount = 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteMessageCount();
          this.configurationManaged = false;
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java
index f57d391..7065766 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueFactoryImpl.java
@@ -102,7 +102,7 @@ public class QueueFactoryImpl implements QueueFactory {
 
       Queue queue;
       if (lastValueKey(addressSettings) != null) {
-         queue = new LastValueQueue(persistenceID, address, name, filter, 
pageSubscription, user, durable, temporary, autoCreated, 
ActiveMQDefaultConfiguration.getDefaultRoutingType(), 
ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), 
ActiveMQDefaultConfiguration.getDefaultExclusive(), 
ActiveMQDefaultConfiguration.getDefaultGroupRebalance(), 
ActiveMQDefaultConfiguration.getDefaultGroupBuckets(), 
ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch(), 
ActiveMQDefaultCo [...]
+         queue = new LastValueQueue(persistenceID, address, name, filter, 
pageSubscription, user, durable, temporary, autoCreated, 
ActiveMQDefaultConfiguration.getDefaultRoutingType(), 
ActiveMQDefaultConfiguration.getDefaultMaxQueueConsumers(), 
ActiveMQDefaultConfiguration.getDefaultExclusive(), 
ActiveMQDefaultConfiguration.getDefaultGroupRebalance(), 
ActiveMQDefaultConfiguration.getDefaultGroupBuckets(), 
ActiveMQDefaultConfiguration.getDefaultConsumersBeforeDispatch(), 
ActiveMQDefaultCo [...]
       } else {
          queue = new QueueImpl(persistenceID, address, name, filter, 
pageSubscription, user, durable, temporary, autoCreated, scheduledExecutor, 
postOffice, storageManager, addressSettingsRepository, 
executorFactory.getExecutor(), server, this);
       }
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
index faac337..cc6dfc5 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
@@ -493,7 +493,7 @@ public class QueueImpl extends CriticalComponentImpl 
implements Queue {
 
       this.groups = groupMap(this.groupBuckets);
 
-      this.autoDelete = autoDelete == null ? 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete() : autoDelete;
+      this.autoDelete = autoDelete == null ? 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDelete(autoCreated) : 
autoDelete;
 
       this.autoDeleteDelay = autoDeleteDelay == null ? 
ActiveMQDefaultConfiguration.getDefaultQueueAutoDeleteDelay() : autoDeleteDelay;
 

Reply via email to