Reputation: 79
I have a very simple setup with 2 nodes (connected to each other). I have a unit test that produces 10 messages on a queue, then consumes all the messages from the queue and then check that it received 10 messages.
Here is the producer and consumer setup
<bean id="queueListener" class="SessionAwareMessageListener<TextMessage>" />
<jms:listener-container container-type="default" destination-type="queue" connection-factory="brokerPooledConnectionFactory" acknowledge="auto">
<jms:listener destination="queue.private.mb.sanity.V4" ref="queueListener" />
</jms:listener-container>
<bean id="queuePublisher" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="brokerPooledConnectionFactory" />
<property name="defaultDestinationName" value="queue.private.mb.sanity.V4" />
</bean>
And the connection setup
<amq:connectionFactory
brokerURL="failover:(tcp://${broker1.host}:${broker1.port},tcp://${broker2.host}:${broker2.port})?maxReconnectAttempts=1&startupMaxReconnectAttempts=1"
closeTimeout="100" id="brokerConnectionFactory" />
<!-- Pools of connections -->
<bean id="brokerPooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
<property name="maxConnections" value="5" />
<property name="idleTimeout" value="0" />
<property name="connectionFactory" ref="brokerConnectionFactory" />
<property name="maximumActiveSessionPerConnection" value="100" />
<property name="timeBetweenExpirationCheckMillis" value="60000" />
<property name="expiryTimeout" value="600000" />
</bean>
What I see is that message are dispatched on the 2 nodes. Message received on the 2nd node are all consumed. Some messages received on the 1st node are routed to the 2nd node and consumed from the 2nd node. The other messages received on the 1st node are neither routed nor consumed.
If I launch a consumer connecting directly to the 1st node, it is able to consume the messages.
The same test with a topic instead of a queue works fine.
Any idea why I'm facing that behavior?
Thanks
Nicolas
Upvotes: 0
Views: 599
Reputation: 79
Indeed, it was a setup issue. The message-load-balancing was set to STRICT instead of ON_DEMAND.
Upvotes: 1