You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2021/09/06 10:08:48 UTC

[activemq-artemis] 02/02: ARTEMIS-1612 - strip any acceptor matching prefix from the message address such that further routing will match the lack of prefixes in broker routing, different fix for redistribution with prefixes

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

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

commit b27aa03a372f525263a746281f9cc77856312d6b
Author: gtully <ga...@gmail.com>
AuthorDate: Tue Jul 27 12:44:05 2021 +0100

    ARTEMIS-1612 - strip any acceptor matching prefix from the message address such that further routing will match the lack of prefixes in broker routing, different fix for redistribution with prefixes
---
 .../activemq/artemis/core/server/impl/ServerSessionImpl.java       | 7 ++++++-
 .../activemq/artemis/tests/integration/client/CoreClientTest.java  | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

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 dfc7771..6e7805a 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
@@ -2166,7 +2166,12 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
             }
          } */
 
-      AddressInfo art = getAddressAndRoutingType(new AddressInfo(msg.getAddressSimpleString(), routingType));
+      final AddressInfo targetFromMessage = new AddressInfo(msg.getAddressSimpleString(), routingType);
+      AddressInfo art = getAddressAndRoutingType(targetFromMessage);
+      if (art != targetFromMessage) {
+         // remove the prefix from the message, with the address model change, only non prefixed addresses exist on the broker
+         msg.setAddress(art.getName());
+      }
 
       // check the user has write access to this address.
       try {
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
index cc9894f..9ef50b7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/CoreClientTest.java
@@ -258,6 +258,8 @@ public class CoreClientTest extends ActiveMQTestBase {
             for (int i = 0; i < numMessages / anycastPrefixes.size(); i++) {
                ClientMessage message = consumer.receive(1000);
                assertNotNull(message);
+               // this seems to be the only assert of this non requirement
+               assertFalse(message.getAddress().contains(queuePrefix));
                message.acknowledge();
             }
             assertNull(consumer.receiveImmediate());