Advertise with us

Our eBooks

Using the ActiveMQ journal with a JDBC Store

In this tutorial we have described how to configure the JDBC Store with ActiveMQ: Using a JDBC Store with ActiveMQ . We will see now how we can improve the performance of it by using the ActiveMQ journal.

Using the ActiveMQ journal can improve the performance of the JDBC store as messages can be stored locally on the filesystem before being committed to the database. On the other hand, it cannot be used on a Master-Slave scenario as there is no guarantee that messages are exactly replicated if one of the Broker fails.

Here is the configuration of the Journal, which uses the MySQL JDBC datasource:

<beans xmlns="" xmlns:xsi="" xsi:schemaLocation="">
       . . .
   <broker xmlns="" brokerName="localhost" dataDirectory="${}">
        . . . .
         . . .
         <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data" dataSource="#mysql-ds" />
        . . . .
         . . .
         <bean xmlns="" class="org.apache.activemq.hooks.SpringContextHook" />
        dataDirectory="activemq-data" />
   <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true" />
      <property name="username" value="francesco" />
      <property name="password" value="francesco" />
      <property name="maxActive" value="200" />
      <property name="poolPreparedStatements" value="true" />
   <import resource="jetty.xml" />
© 2021 All Rights Reserved.

Please publish modules in offcanvas position.