ActiveMQ has two mode of configuration, a Network of Broker mode and HA mode. Network of Brokers help in distribute the loading among the network members. It is done by a client randomly connect to one of the network member, the member is responsible for resolving queue content from the producer queue.
In HA mode, they are using either a locking file (KahnDB) or locking DB (DB exclusive lock) approach. It is using a master-slave approach. When the master obtains the lock, others turns to slave mode and regularly poll for the availability of the lock. If the master goes down, the lock will be released and others will race for it.
I have tested a setup with a network of two members, and each member has the corresponding HA master-slave pair.
The configuration can be found in the following GitHub
To test the ActiveMQ, we can use ActiveMQ producer and consumer command to test with it.