[ 
https://issues.apache.org/jira/browse/ARTEMIS-5183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tommy Lindgren updated ARTEMIS-5183:
------------------------------------
    Description: 
If client 1 subscribes with {{noLocal=true}} to {{/topic/example}} and client 2 
sends messages to {{/topic/example}} but doesn't use {{noLocal}}, then client 1 
won't see the messages from client 2.

If {{noLocal=true}}, {{StompConnect.java}} will add {{__AMQ_CID<>xxx }} to the 
selector. However, the {{__AMQ_CID}} header is only added to the message if 
{{noLocal}} is enabled, so the selector won't match anything (presumably 
because {{<>} }never matches NULL).

Untested potential patch:
{noformat}
diff --git 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index bf0d09f955..29f9301f29 100644
--- 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -496,9 +496,8 @@ public final class StompConnection extends 
AbstractRemotingConnection {
       try {
          StompSession stompSession = getSession(txID);
 
-         if (stompSession.isNoLocal()) {
-            message.putStringProperty(CONNECTION_ID_PROPERTY_NAME_STRING, 
getID().toString());
-         }
+         message.putStringProperty(CONNECTION_ID_PROPERTY_NAME_STRING, 
getID().toString());
+
          if (isEnableMessageID()) {
             message.putStringProperty("amqMessageId", "STOMP" + 
message.getMessageID());
          }{noformat}

  was:
If client 1 subscribes with {{noLocal=true}} to /{{{}topic/example {}}}and 
client 2 sends messages to {{/topic/example }}but doesn't use noLocal, then 
client 1 won't see the messages from client 2.

If n{{{}oLocal=true{}}}, {{StompConnect.java}} will add {{__AMQ_CID<>xxx }}to 
the selector. However, the {{__AMQ_CID}} header is only added to the message if 
{{noLocal}} is enabled, so the selector won't match anything (presumably 
because {{<> }}never matches NULL).

Untested potential patch:
{noformat}
diff --git 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
index bf0d09f955..29f9301f29 100644
--- 
a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
+++ 
b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
@@ -496,9 +496,8 @@ public final class StompConnection extends 
AbstractRemotingConnection {
       try {
          StompSession stompSession = getSession(txID);
 
-         if (stompSession.isNoLocal()) {
-            message.putStringProperty(CONNECTION_ID_PROPERTY_NAME_STRING, 
getID().toString());
-         }
+         message.putStringProperty(CONNECTION_ID_PROPERTY_NAME_STRING, 
getID().toString());
+
          if (isEnableMessageID()) {
             message.putStringProperty("amqMessageId", "STOMP" + 
message.getMessageID());
          }{noformat}


> Stomp consumer with noLocal can't receive messages from producer not using 
> noLocal
> ----------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-5183
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5183
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: STOMP
>    Affects Versions: 2.37.0
>            Reporter: Tommy Lindgren
>            Assignee: Justin Bertram
>            Priority: Major
>
> If client 1 subscribes with {{noLocal=true}} to {{/topic/example}} and client 
> 2 sends messages to {{/topic/example}} but doesn't use {{noLocal}}, then 
> client 1 won't see the messages from client 2.
> If {{noLocal=true}}, {{StompConnect.java}} will add {{__AMQ_CID<>xxx }} to 
> the selector. However, the {{__AMQ_CID}} header is only added to the message 
> if {{noLocal}} is enabled, so the selector won't match anything (presumably 
> because {{<>} }never matches NULL).
> Untested potential patch:
> {noformat}
> diff --git 
> a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
>  
> b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
> index bf0d09f955..29f9301f29 100644
> --- 
> a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
> +++ 
> b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
> @@ -496,9 +496,8 @@ public final class StompConnection extends 
> AbstractRemotingConnection {
>        try {
>           StompSession stompSession = getSession(txID);
>  
> -         if (stompSession.isNoLocal()) {
> -            message.putStringProperty(CONNECTION_ID_PROPERTY_NAME_STRING, 
> getID().toString());
> -         }
> +         message.putStringProperty(CONNECTION_ID_PROPERTY_NAME_STRING, 
> getID().toString());
> +
>           if (isEnableMessageID()) {
>              message.putStringProperty("amqMessageId", "STOMP" + 
> message.getMessageID());
>           }{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to