LibraryToggle FramesPrintFeedback

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 ...>
  ...
1  <persistenceAdapter>
2    <jdbcPersistenceAdapter dataSource="#derby-ds" />
    </persistenceAdapter>
    ...
  <broker>
  ...
3<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:

1

The persistenceAdapter element wraps the configuration for the JDBC persistence adapter.

2

The jdbcPersistenceAdapter element specifies that the broker will use the plain JDBC persistence adapter and that the JDBC driver's configuration is specified in a bean element with the ID, derby-ds.

3

The bean element specified the configuration for the Derby JDBC driver.

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

AttributeDefault ValueDescription
adapter  Specifies the strategy to use when accessing a non-supported database. For more information see Using generic JDBC providers.
cleanupPeriod 300000Specifies, in milliseconds, the interval at which acknowledged messages are deleted.
createTablesOnStartup trueSpecifies whether or not new database tables are created when the broker starts. If the database tables already exist, the existing tables are reused.
databaseLockerDefaultDatabaseLocker instanceThe locker instance that prevents more than one broker from accessing the database at a time.
dataDirectory activemq-dataSpecifies the directory into which the default Derby database writes its files.
dataSource #derbySpecifies the id of the Spring bean storing the JDBC driver's configuration. For more information see Configuring your JDBC driver.
lockAcquireSleepInterval1000Time interval (ms) between lock acquire attempts, when using the default database locker. Does not apply to custom database lockers, specified using databaseLocker.
lockKeepAlivePeriod30000Periodically 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 trueSpecifies whether or not an exclusive database lock should be used to enable JDBC Master/Slave—see JDBC Master/Slave in Clustering Guide.
transactionIsolationConnection.TRANSACTION_READ_UNCOMMITTEDSpecifies the required transaction isolation level. For allowed values, see java.sql.Connection.

Comments powered by Disqus