How to Setup JDBC Persistence in JBoss A-MQ

1) Install the Apache Commons DBCP bundle:

osgi:install mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_3

2) Install a JDBC driver.

3) Define a data source in the <JBoss A-MQ Install Dir>/etc/activemq.xml file:

<bean id="sample-ds" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <!-- any driver -->
  <property name="url" value="jdbc:mysql://localhost/sample_db"/>
  <property name="username" value="username"/>
  <property name="password" value="password"/>
</bean>

4) Change the persistence adapter in the <JBoss A-MQ Install Dir>/etc/activemq.xml file:

<persistenceAdapter>
  <jdbcPersistenceAdapter dataSource="#sample-ds"/>
</persistenceAdapter>

5) Start JBoss A-MQ.

You can find more details here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s