I am trying to setup two activemq brokers used as communication channel for several microservices.
I would like to:
- Have the brokers on two different machines and obtain that the two brokers are in failover, where upon switching off one of the machines, the other acquires a lock and becomes the master.
- Don’t have to worry about primary/secondary memory usage that comes with persistent messages.
In short I want to have redundant brokers with no persistence, so I can, for example, switch off one node for mainteinance and have the other accept connections.
It seems there is not way to achieve this as of 5.3.18, since a broker configured to use Kahadb as Shared File System Master Slave but with persistent=”false” attribute active
produces this log:
WARN | persistent="false", ignoring configured persistenceAdapter: KahaDBPersistenceAdapter
and the brokers effectively ignore the lock file check (they both go active).
The two relavant bits of configuration in settings.xml are:
...
<broker persistent="false" xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
...
<persistenceAdapter>
<kahaDB directory="/mnt/SHARED_AMQ" lockKeepAlivePeriod="1000">
<locker>
<shared-file-locker lockAcquireSleepInterval="1000"/>
</locker>
</kahaDB>
</persistenceAdapter>
...
Mind that I achieved the working redundant configuration with persistency, removing the persistent="false"
.