Trying to browse a queue using the ActiveMQ web console or jconsole does not return any messages although the QueueSize reports a count greater than 0.
Although there is a consumer connected to a queue, it does not receive any messages.
In the particular case where this behavior was observed the broker environment used a network of two broker instances. Clients (consumers and producers) were randomly connecting to one of the brokers in the network.
Both broker instances were further configured to allow messages to be replayed back to the original broker using the replayWhenNoConsumers property on the policy configuration:
<policyEntry queue=">" producerFlowControl="true" memoryLimit="10mb"> <networkBridgeFilterFactory> <conditionalNetworkBridgeFilterFactory replayWhenNoConsumers="true" /> </networkBridgeFilterFactory> </policyEntry>
Using replayWhenNoConsumers allows messages to be played back to the original broker over the network bridge when there is no consumer connected to the broker that is holding those messages. This avoids that messages are getting stuck on a broker just because there is no consumer connected to that broker.
On the other hand duplicate detection is enabled in a broker by default. This prevents those replayed messages to be dispatched to consumers as the broker that receives those replayed messages considers them as duplicates.
The problem is fully discussed in the following blog post.
- Messages don't hop across multiple ActiveMQ brokers in a Network-Of-Brokers setup
- Fuse Message Broker all versions
- Network of Broker instances
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.