Reproducer Attached.
To run, extract and correct paths as needed in A/bin/artemis, A/etc/artemis.profile, A/etc/bootstrap.xml, B/bin/artemis, B/etc/artemis.profile, and B/etc/bootstrap.xml.
Run script reproducer.sh to execute the workflow below.
Basic Workflow Is As Follows:
Setup a two broker cluster. No special settings really needed here, generally speaking defaults will do. I used a redistribution-delay of 5k ms, but I doubt the actual value matters as long as its greater than 0. I also have the following properties on the acceptor for openwire: virtualTopicConsumerWildcards=Consumer.*.VirtualTopic.%3E%3B2%3BselectorAware=true
Auto-create a few queues using the virtualTopic naming scheme. In this test we have these two on each broker:
Consumer.RH_001.VirtualTopic.Test.Topic - this one has a selector/filter of MyProp='10001'. The acceptor properties should map the consumer selector to a queue filter automatically.
Consumer.RH_002.VirtualTopic.Test.Topic - this one has no selector/filter
Connect one consumer to each broker on Consumer.RH_002.VirtualTopic.Test.Topic (the queue with the selectors applied)
Don't connect any consumers yet to Consumer.RH_002.VirtualTopic.Test.Topic. This is to simulate the offline client in our real-world issue.
Publish messages to 'VirtualTopic.Test.Topic' with a header like message.setStringProperty("MyProp", "10001"). You will see that these messages all load up on one broker for Consumer.RH_002.VirtualTopic.Test.Topic where there is no consumer, and the messages are evenly distributed and consumed for Consumer.RH_001.VirtualTopic.Test.Topic.
Now connect a consumer to the Consumer.RH_002.VirtualTopic.Test.Topic queue on the opposite broker where messages are piled up for it. For example, if all the messages for Consumer.RH_002.VirtualTopic.Test.Topic are on broker A then connect the consumer to broker B so that everything gets redistributed.
If you observe the counts on Consumer.RH_001.VirtualTopic.Test.Topic queue, you will see that when messages were redistributed for Consumer.RH_002.VirtualTopic.Test.Topic that they all were also redistributed to Consumer.RH_001.VirtualTopic.Test.Topic as if they were being fanned out again and the added count goes up for both queues.
The extras end up in the DLQ as duplicates.