activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2638 retro resources created recursively w/# match
Date Fri, 01 May 2020 16:56:59 GMT
This is an automated email from the ASF dual-hosted git repository.

jbertram 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 ea09a0f  ARTEMIS-2638 retro resources created recursively w/# match
     new a38d586  This closes #3004
ea09a0f is described below

commit ea09a0fd39290d63a711f4353096a7092f2a6cfd
Author: Justin Bertram <jbertram@apache.org>
AuthorDate: Thu Mar 5 21:00:15 2020 -0600

    ARTEMIS-2638 retro resources created recursively w/# match
---
 .../artemis/core/postoffice/impl/PostOfficeImpl.java      |  2 +-
 .../tests/integration/server/RetroactiveAddressTest.java  | 15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

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 f74c505..7f207c9 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
@@ -466,7 +466,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener,
Binding
                   server.callBrokerAddressPlugins(plugin -> plugin.afterAddAddress(addressInfo,
reload));
                }
                long retroactiveMessageCount = addressSettingsRepository.getMatch(addressInfo.getName().toString()).getRetroactiveMessageCount();
-               if (retroactiveMessageCount > 0) {
+               if (retroactiveMessageCount > 0 && !addressInfo.isInternal() &&
!ResourceNames.isRetroactiveResource(server.getInternalNamingPrefix(), addressInfo.getName()))
{
                   createRetroactiveResources(addressInfo.getName(), retroactiveMessageCount,
reload);
                }
                if (ResourceNames.isRetroactiveResource(server.getInternalNamingPrefix(),
addressInfo.getName())) {
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java
index 21a8dc3..06bce01 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/RetroactiveAddressTest.java
@@ -100,13 +100,22 @@ public class RetroactiveAddressTest extends ActiveMQTestBase {
    }
 
    @Test
-   public void testRetroactiveResourceCreation() throws Exception {
-      final SimpleString addressName = SimpleString.toSimpleString("myAddress");
+   public void testRetroactiveResourceCreationWithExactMatch() throws Exception {
+      internalTestRetroactiveResourceCreation("myAddress", "myAddress");
+   }
+
+   @Test
+   public void testRetroactiveResourceCreationWithWildcardMatch() throws Exception {
+      internalTestRetroactiveResourceCreation("myAddress", "#");
+   }
+
+   private void internalTestRetroactiveResourceCreation(String address, String match) throws
Exception {
+      final SimpleString addressName = SimpleString.toSimpleString(address);
       final SimpleString divertAddress = ResourceNames.getRetroactiveResourceAddressName(internalNamingPrefix,
delimiter, addressName);
       final SimpleString divertMulticastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix,
delimiter, addressName, RoutingType.MULTICAST);
       final SimpleString divertAnycastQueue = ResourceNames.getRetroactiveResourceQueueName(internalNamingPrefix,
delimiter, addressName, RoutingType.ANYCAST);
       final SimpleString divert = ResourceNames.getRetroactiveResourceDivertName(internalNamingPrefix,
delimiter, addressName);
-      server.getAddressSettingsRepository().addMatch(addressName.toString(), new AddressSettings().setRetroactiveMessageCount(10));
+      server.getAddressSettingsRepository().addMatch(match, new AddressSettings().setRetroactiveMessageCount(10));
       server.addAddressInfo(new AddressInfo(addressName));
       assertNotNull(server.getAddressInfo(divertAddress));
       assertNotNull(server.locateQueue(divertMulticastQueue));


Mime
View raw message