Github user onlyMIT commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2466#discussion_r242582946
--- Diff:
artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSubscriptionManager.java
---
@@ -194,12 +191,13 @@ private synchronized void removeSubscription(String
address) throws Exception {
SimpleString internalQueueName =
getQueueNameForTopic(internalAddress);
session.getSessionState().removeSubscription(address);
-
- ServerConsumer consumer = consumers.get(address);
+ Set<Consumer> queueConsumers =
session.getServer().queueConsumersQuery(internalQueueName);
--- End diff --
In the âqueueConsumersQueryâ method, use 'queueName' to query 'Binding'
and get a queue through âBindingâ. I think I am getting all the consumers
in the specified queue, not all consumers at the same address.You can check the
details of the 'queueConsumersQuery' method.
In the âActiveMQServerImpl.destroyQueueâ method, the number of
consumers on a queue is also obtained in this way.Originally I wanted to put
the shutdown consumer code here, and later found that there were multiple calls
to the âActiveMQServerImpl.destroyQueueâ method, and I abandoned the idea
of putting the consumer code off here.
---