For those cases where journaling is not appropriate, or you wish to use your own journaling system, you can used the JDBC persistence adapter without the Fuse Message Broker high performance journal.
Example 3.4 shows a configuration fragment that configures the plain JDBC adapter to use the Apache Derby database.
Example 3.4. Configuring Fuse Message Broker to use the Plain JDBC Persistence Adapter
<beans ... > <broker ...> ... <persistenceAdapter> <jdbcPersistenceAdapter dataSource="#derby-ds" /> </persistenceAdapter> ... <broker> ... <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource"> <property name="databaseName" value="derbydb"/> <property name="createDatabase" value="create"/> </bean>
The configuration in Example 3.4 has three noteworthy elements:
The | |
The | |
The |
Table 3.2 describes the attributes used to configure the non-journaled JDBC persistence adapter.
Table 3.2. Attributes for Configuring the Plain JDBC Persistence Adapter
Attribute | Default Value | Description |
---|---|---|
adapter
| Specifies the strategy to use when accessing a non-supported database. For more information see Using generic JDBC providers. | |
cleanupPeriod
| 300000 | Specifies, in milliseconds, the interval at which acknowledged messages are deleted. |
createTablesOnStartup
| true | Specifies whether or not new database tables are created when the broker starts. If the database tables already exist, the existing tables are reused. |
databaseLocker | DefaultDatabaseLocker instance | The locker instance that prevents more than one broker from accessing the database at a time. |
dataDirectory
| activemq-data | Specifies the directory into which the default Derby database writes its files. |
dataSource
| #derby | Specifies the id of the Spring bean storing the JDBC driver's configuration. For more information see Configuring your JDBC driver. |
lockAcquireSleepInterval | 1000 | Time interval (ms) between lock acquire attempts, when using the
default database locker. Does not apply to custom database lockers,
specified using databaseLocker . |
lockKeepAlivePeriod | 30000 | Periodically save the current time in the locker table, at time intervals specified by this option (ms). This ensure that the lock does not time out. |
useDatabaseLock
| true | Specifies whether or not an exclusive database lock should be used to enable JDBC Master/Slave—see JDBC Master/Slave in Clustering Guide. |
transactionIsolation | Connection.TRANSACTION_READ_UNCOMMITTED | Specifies the required transaction isolation level. For allowed values, see java.sql.Connection. |