We have a VirtualTopic "VirtualTopic.multi_dest" and 2 consumers :
Message producer send messages on that vTopic with various "tenant" header value.
Each consumer use a selector to receive only desired data :
- tenant='alpha' for Consumer.alpha.VirtualTopic.multi_dest
- tenant='beta' for Consumer.beta.VirtualTopic.multi_dest
To avoid to get many pending message on each consumer queue, we activated selectorAware="true" in broker settings.
To avoid to lose message on temporary consumer deconnection, we activated virtualSelectorCacheBrokerPlugin plugin.
Steps to reproduce bug :
- launch message producer and both message consumers alpha and beta
- stop alpha consumer
- notice on console pending messages on alpha queue increase
- if we restart alpha consumer, all pending messages are consumed => ok, only messages matching selector were in queue
- restop alpha consumer
- go on console and click on "Browse" link for alpha consumer queue
- restart alpha consumer => it will consume pending messages matching selector
- notice there are other waiting messages that do not match selector, so the consumer queue is fastly full of useless messages => ko
- even after broker restart, the alpha consumer queue continues to receive message that do not match selectors => ko
After code analysis, I notice "Browse" action create a new consumer on queue. In virtualSelectorCacheBrokerPlugin, the addConsumer method update "subSelectorCache" variable with 'TRUE' selector.
A pull request is submitted to fix that issue (https://github.com/apache/activemq/pull/395), could you merge it for the next patch 5.15.11 ?