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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact