[ 
https://issues.apache.org/jira/browse/ARTEMIS-5184?focusedWorklogId=951145&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-951145
 ]

ASF GitHub Bot logged work on ARTEMIS-5184:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Jan/25 11:40
            Start Date: 07/Jan/25 11:40
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on code in PR #5414:
URL: https://github.com/apache/activemq-artemis/pull/5414#discussion_r1905331100


##########
artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java:
##########
@@ -231,6 +232,9 @@ public void closed() {
    public void disconnect(ServerConsumer consumerId, String errorDescription) {
       StompSubscription stompSubscription = 
subscriptions.remove(consumerId.getID());
       if (stompSubscription != null) {
+         if (stompSubscription.isNoLocal()) {
+            noLocalSubscriptionCount.decrementAndGet();
+         }

Review Comment:
   This disconnect method looks to be the only place a decrement is done...what 
if the subscription is explicitly unsubscribed and so this doesnt occur?



##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java:
##########
@@ -1501,6 +1501,26 @@ public void testSubscribeToTopicWithNoLocal() throws 
Exception {
       conn.disconnect();
    }
 
+   @Test
+   public void testSubscribeToTopicWithNoLocalAndNormal() throws Exception {
+      conn.connect(defUser, defPass);
+      subscribeTopic(conn, RandomUtil.randomString(), null, null, true, true);
+      subscribeTopic(conn, RandomUtil.randomString(), null, null, true, false);
+      int normalCount = 0;
+      int noLocalCount = 0;
+      for (Binding binding : 
server.getPostOffice().getBindingsForAddress(SimpleString.of(getTopicPrefix() + 
getTopicName())).getBindings()) {
+         if (binding.getFilter() != null && 
binding.getFilter().getFilterString().toString().contains("__AMQ_CID")) {
+            noLocalCount++;
+         } else {
+            normalCount++;
+         }
+      }
+      assertEquals(1, noLocalCount);
+      assertEquals(1, normalCount);
+
+      conn.disconnect();

Review Comment:
   Probably worth verifying removals behave are as expected also, and perhaps 
sending a message after and checking the expected behaviours, e.g around the 
header.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 951145)
    Time Spent: 20m  (was: 10m)

> STOMP noLocal is scoped to session not subscription
> ---------------------------------------------------
>
>                 Key: ARTEMIS-5184
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5184
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: STOMP
>    Affects Versions: 2.37.0
>            Reporter: Tommy Lindgren
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> It looks like {{activemq.noLocal}} is scoped to the Stomp session, not the 
> subscription, i.e. {{noLocal}} for the last subscription decides what setting 
> all subscriptions will use. I believe this is a regression from ActiveMQ 
> Classic.



--
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