Skip to main content

Configure ActiveMQ

You need to configure ActiveMQ for file system persistence and database persistence. For details, see the following sections:

  • Configure ActiveMQ for file system persistence
  • ActiveMQ JDBC based deployment for database persistence

Configure ActiveMQ for file system persistence

By default, ActiveMQ uses <ACTIVEMQ_HOME>/data/kahadb directory to store files. Change the network path for both the brokers to use the shared directory. The ActiveMQ instance that comes up first becomes the Master and puts a lock on the file system and the second instance becomes the Slave.

  1. Create a shared directory named sharedBrokerData on one of the machines.
tip

You can use same machine for AE working directory and ActiveMQ storage.

  1. Edit the configuration file activemq.xml in C:/tools/apache-activemq-6.1.x/conf directory on both machines, and set kahaDB directory to network path of the shared directory created in step 1. Sample configuration:
----
----
<persistenceAdapter>
<kahaDB directory=”\\LPT0667\sharedBrokerData” />
</persistenceAdapter>
----
----

ActiveMQ JDBC based deployment for database persistence (optional)

Brokers can be configured in database. The ActiveMQ instance that comes up first becomes the Master and puts a lock on the database table and the second instance becomes the Slave. For details about ActiveMQ JDBC based deployments, see Install Apache ActiveMQ from AutomationEdge Installation guide.

AE configuration with Master/Slave brokers with failover protocol

AE configuration with Master/Slave brokers with failover protocol is applicable to both brokers in using Shared File System or Database.

AE application, as a client, should be using the Failover Transport to connect to the available brokers. For example, using a URL like: failover:(tcp://broker1-IP/Hostname:Port,tcp://broker2-IP/Hostname:Port ,tcp://broker3-IP/Hostname:Port)

With the failover protocol, application does not have to deal with any reconnection logic. Client is always connected with the master.

To configure AE to work with master/slave brokers, edit the file ae.properties in <AE_HOME>/conf directory and set the value for property activemq.broker.url as follows:

activemq.broker.url=failover:(tcp://<machine1-IP/Hostname>:61616,tcp://<machine2-IP/Hostname>:61616)?maxReconnectAttempts=10&warnAfterReconnectAttempts=5