Reputation: 5840
I want my ActiveMQ to have two active brokers.
One which is the primary and second to act when the first is unavailable.
How to define this brokers in the activemq.xml file?
I tried adding the broker by simply copy and paste the defualt one and changing the port and name, but that throws an exception when trying to run the activemq.
Additionally how can i know which broker is activelly managing the incoming outgoing messages on my queue?
Thanks.
Upvotes: 1
Views: 334
Reputation: 86
By using failover protocol on client messages will be routed to slave broker when master broker is not available, but make sure randomize=false.
eg : failover:(tcp://master:61616,tcp://slave:61616)?randomize=false
When master broker failed and messages are still waiting in master broker's data store, to consume those waiting messages configure slave broker and master broker to same JDBC data store.
By configuring master and slave broker to same JDBC data store your master broker will lock the JDBC data store and slave broker will become active only when master broker fails which will release lock on the data store.
Make sure master broker is started before slave brokers in above mentioned configuration.
Upvotes: 1
Reputation: 15758
You can implement this using the failover:// protocol in the JMS client. See the Failover Transport Reference page for details of how to configure the failover protocol.
This was reliable:// protocol in ActiveMQ 3.x and failover:// in ActiveMQ versions greater than 3.x
Here is a good article
Upvotes: 1