[activemq-artemis] branch master updated: ARTEMIS-2292 - Fix queue level auto-delete for topic subscription queue

2019-04-02 Thread michaelpearce
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 
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
 

[activemq-artemis] branch master updated: ARTEMIS-2292 - Fix queue level auto-delete for topic subscription queue

2019-04-02 Thread clebertsuconic
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 0df9205  ARTEMIS-2292 - Fix queue level auto-delete for topic 
subscription queue
 new 5b0a795  This closes #2603
0df9205 is described below

commit 0df9205aca1686d3b827ee64b5553e72bfd486b7
Author: Michael André Pearce 
AuthorDate: Tue Apr 2 16:28:47 2019 +0100

ARTEMIS-2292 - Fix queue level auto-delete for topic subscription queue

Additional bits missed
---
 .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java  |  2 +-
 .../activemq/artemis/core/server/impl/ServerSessionImpl.java   | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

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 0009f1e..7e8f3a3 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
@@ -1774,7 +1774,7 @@ public class ActiveMQServerImpl implements ActiveMQServer 
{
   return createQueue(addressInfo, queueName, filter, user, durable, 
temporary, false, false, autoCreated, maxConsumers, purgeOnNoConsumers, 
exclusive, groupRebalance, groupBuckets, lastValue, lastValueKey, 
nonDestructive, consumersBeforeDispatch, delayBeforeDispatch, autoDelete, 
autoDeleteDelay, autoDeleteMessageCount, autoCreateAddress, false);
}
 
-   private static boolean isAutoDelete(boolean autoCreated, AddressSettings 
addressSettings) {
+   static boolean isAutoDelete(boolean autoCreated, AddressSettings 
addressSettings) {
   return autoCreated ? addressSettings.isAutoDeleteQueues() : 
addressSettings.isAutoDeleteCreatedQueues();
}
 
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 9c5ceeb..ec1c79d 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -614,7 +614,7 @@ public class ServerSessionImpl implements ServerSession, 
FailureListener {
@Override
public Queue createQueue(AddressInfo addressInfo, SimpleString name, 
SimpleString filterString, boolean temporary, boolean durable) throws Exception 
{
   AddressSettings as = 
server.getAddressSettingsRepository().getMatch(addressInfo.getName().toString());
-  return createQueue(addressInfo, name, filterString, temporary, durable, 
as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), 
as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), 
as.getDefaultGroupBuckets(), as.isDefaultLastValueQueue(), 
as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), 
as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), 
as.isAutoDeleteQueues(), as.getAutoDeleteQueuesDelay(), 
as.getAutoDeleteQueuesMessageCount(), false);
+  return createQueue(addressInfo, name, filterString, temporary, durable, 
as.getDefaultMaxConsumers(), as.isDefaultPurgeOnNoConsumers(), 
as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), 
as.getDefaultGroupBuckets(), as.isDefaultLastValueQueue(), 
as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), 
as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), 
ActiveMQServerImpl.isAutoDelete(false, as), as.getAutoDeleteQueuesDelay(), 
as.getAutoDeleteQueues [...]
}
 
public Queue createQueue(final AddressInfo addressInfo,
@@ -700,7 +700,7 @@ public class ServerSessionImpl implements ServerSession, 
FailureListener {
 final boolean purgeOnNoConsumers,
 final boolean autoCreated) throws Exception {
   AddressSettings as = 
server.getAddressSettingsRepository().getMatch(address.toString());
-  return createQueue(new AddressInfo(address, routingType), name, 
filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, 
as.isDefaultExclusiveQueue(), as.isDefaultGroupRebalance(), 
as.getDefaultGroupBuckets(), as.isDefaultLastValueQueue(), 
as.getDefaultLastValueKey(), as.isDefaultNonDestructive(), 
as.getDefaultConsumersBeforeDispatch(), as.getDefaultDelayBeforeDispatch(), 
as.isAutoDeleteQueues(), as.getAutoDeleteQueuesDelay(), 
as.getAutoDeleteQueuesMessageCount(), autoCreated);
+  return createQueue(new AddressInfo(address, routingType), name, 
filterString, temporary, durable, maxConsumers, purgeOnNoConsumers, 
as.isDefaultExclusiveQueue(), 

[activemq-artemis] branch master updated: ARTEMIS-2292 - Fix queue level auto-delete for topic subscription queue

2019-04-02 Thread clebertsuconic
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 c4fce10  ARTEMIS-2292 - Fix queue level auto-delete for topic 
subscription queue
 new 71ec3c6  This closes #2602
c4fce10 is described below

commit c4fce10fac380c019c63d38eb9090d1628937da5
Author: Michael André Pearce 
AuthorDate: Tue Apr 2 08:29:40 2019 +0100

ARTEMIS-2292 - Fix queue level auto-delete for topic subscription queue
---
 .../deployers/impl/FileConfigurationParser.java|   4 +
 .../management/impl/ActiveMQServerControlImpl.java |   2 +-
 .../core/postoffice/impl/PostOfficeImpl.java   |   2 +-
 .../core/server/impl/ActiveMQServerImpl.java   |  18 +--
 .../artemis/core/server/impl/QueueManagerImpl.java |   8 +-
 .../core/server/impl/ServerSessionImpl.java|   2 +-
 .../core/settings/impl/AddressSettings.java|  34 +-
 .../resources/schema/artemis-configuration.xsd |   8 ++
 docs/user-manual/en/address-model.md   |   6 +
 docs/user-manual/en/configuration-index.md |   1 +
 .../jms/client/QueueAutoDeleteTest.java| 121 +
 11 files changed, 190 insertions(+), 16 deletions(-)

diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
index 0a838cb..ffd598d 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java
@@ -222,6 +222,8 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
 
private static final String AUTO_DELETE_QUEUES = "auto-delete-queues";
 
+   private static final String AUTO_DELETE_CREATED_QUEUES = 
"auto-delete-created-queues";
+
private static final String AUTO_DELETE_QUEUES_DELAY = 
"auto-delete-queues-delay";
 
private static final String AUTO_DELETE_QUEUES_MESSAGE_COUNT = 
"auto-delete-queues-message-count";
@@ -1074,6 +1076,8 @@ public final class FileConfigurationParser extends 
XMLConfigurationUtil {
 addressSettings.setAutoCreateQueues(XMLUtil.parseBoolean(child));
  } else if (AUTO_DELETE_QUEUES.equalsIgnoreCase(name)) {
 addressSettings.setAutoDeleteQueues(XMLUtil.parseBoolean(child));
+ } else if (AUTO_DELETE_CREATED_QUEUES.equalsIgnoreCase(name)) {
+
addressSettings.setAutoDeleteCreatedQueues(XMLUtil.parseBoolean(child));
  } else if (AUTO_DELETE_QUEUES_DELAY.equalsIgnoreCase(name)) {
 long autoDeleteQueuesDelay = XMLUtil.parseLong(child);
 Validators.GE_ZERO.validate(AUTO_DELETE_QUEUES_DELAY, 
autoDeleteQueuesDelay);
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index 917b18c..d14a358 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -955,7 +955,7 @@ public class ActiveMQServerControlImpl extends 
AbstractControl implements Active
   addressSettings.isDefaultNonDestructive(),
   addressSettings.getDefaultConsumersBeforeDispatch(),
   addressSettings.getDefaultDelayBeforeDispatch(),
-  addressSettings.isAutoDeleteQueues(),
+  addressSettings.isAutoDeleteCreatedQueues(),
   addressSettings.getAutoDeleteQueuesDelay(),
   addressSettings.getAutoDeleteQueuesMessageCount(),
   autoCreateAddress
diff --git 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 671d4f0..5425c1b 100644
--- 
a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ 
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -1582,7 +1582,7 @@ public class PostOfficeImpl implements PostOffice, 
NotificationListener, Binding
   public void run() {
  for (Queue queue : getLocalQueues()) {
 if (!queue.isInternalQueue() && 
QueueManagerImpl.isAutoDelete(queue) && 
QueueManagerImpl.consumerCountCheck(queue) && 
QueueManagerImpl.delayCheck(queue) && 
QueueManagerImpl.messageCountCheck(queue)) {
-