Using the JDBC persistence adapter with Fuse Message Broker's high performance journal boosts the performance of the persistence adapter in two ways:
In applications where message consumers keep up with the message producers, the journal makes it possible to lower the number of messages that need to be committed to the data base. For example a message producer could publish 10,000 messages between journal checkpoints. If the message consumer pops 9,900 messages off of the queue during the same interval, only 100 messages will be committed to the database through the JDBC adapter.
In applications where the message consumers cannot keep up with the message producers, or in applications where messages must persist for long periods, the journal boosts performance by committing messages in large batches. This means that the JDBC driver can optimize the writes to the external database.
In addition to the performance gains, the high performance journal also makes it possible to ensure the consistency of JMS transactions in the case of a system failure.
Example 8 shows a configuration fragment that configures the journaled JDBC adapter to use a MySQL database.
Example 8. Configuring Fuse Message Broker to use the Journaled JDBC Persistence Adapter
<beans ... > <broker ...> ...<persistenceFactory>
<journaledJDBC journalLogFiles="5" dataSource="#mysql-ds" /> </persistenceFactory> ... <broker> ...
<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="activemq"/> <property name="password" value="activemq"/> <property name="poolPreparedStatements" value="true"/> </bean>
The configuration in Example 8 has three noteworthy elements:
The NoteIn Fuse Message Broker versions prior to 5.4, the | |
The
| |
The |
Table 3 describes the attributes used to configure the journaled JDBC persistence adapter.
Table 3. Attributes for Configuring the Journaled JDBC Persistence Adapter











