0
votes

I have multiple thread groups for pushing message to ActiveMQ using JMeter publisher sampler. My JMeter publisher sampler is configured with ActiveMQ failover URL. When I'm starting the JMeter it is pushing messages to both ActiveMQ irrespective of failover.

The sampler uses the ActiveMQ JNDI initial context factory (org.apache.activemq.jndi.ActiveMQInitialContextFactory)

The Provider URL: failover:(tcp://host1:61616,tcp://host2:61616)

The connection factory is simply the default one provided by ActiveMQ: ConnectionFactory.

The destination is the name of the JMS queue where we want to produce the message, prefixed with dynamicQueuesdynamicQueues/MyQueue.

1

1 Answers

0
votes

As per Failover Transport documentation:

Using Randomize

The Failover transport chooses a URI at random by default. This effectively load-balances clients over multiple brokers. However, to have a client connect to a primary first and only connect to a secondary backup broker when the primary is unavailable, set randomize=false.

So my expectation is that when you run your test with multiple threads (virtual users) each thread sends message to the random broker.

If you want to target the first broker and use the second one only if the first one fails - consider appending ?randomize=false parameter to your failover URL like:

 failover:(tcp://host1:61616,tcp://host2:61616)?randomize=false

More information just in case: Building a JMS Testing Plan - Apache JMeter