...
For full explict control over configuration check out the Xml Configuration. However a quick way to set which persistence adapter to use is to set the following system property to be the class name of the PersistenceAdapter implementation.
Code Block |
activemq.persistenceAdapter
|
When running the broker from the command line, we look for the activemq.xml on the classpath unless you specify one to use. e.g.
AMQ 4.x
Code Block |
activemq xbean:file:myconfig.xml
|
AMQ 3.x
Code Block |
activemq myconfig.xml
|
or just
AMQ3.x/AMQ4.x
Code Block |
activemq
|
Here is a sample XML configuration which shows how to configure the journal and the JDBC persistence.
...
To enable JDBC persistence of JMS messages without journaling, we need to change the message broker's default persistence configuration from
AMQ 4.x
Code Block |
<persistenceAdapter>
<journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"/>
</persistenceAdapter>
|
to
Code Block |
<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#my-ds"/>
</persistenceAdapter>
|
For AMQ 3.x
Code Block |
<persistence>
<journalPersistence directory="../var/journal">
<jdbcPersistence dataSourceRef="derby-ds"/>
</journalPersistence>
</persistence>
|
to
Code Block |
<persistence>
<jdbcPersistence dataSourceRef="derby-ds"/>
</persistence>
|
Make sure to send durable messages so that it will be persisted in the database server while waiting to be consumed by clients. More information on configuration JDBC persistence at JDBC Support
Include Page |
|
Disaster Recovery options
...
If you don't want persistence at all you can disable it easily via the Xml Configuration. e.g.
Code Block |
<broker persistent="false">
</broker>
|
This will make the broker use the <memoryPersistenceAdapter>
For an example of using a configuration URI see How to unit test JMS code