Active MQ - Configure with MySQL

You’ll need to create an activemq configuration file, call it my-activemq.xml say. (Just copy ./conf/activemq.xml and modify it as described here.
Uncomment & update the persistenceAdapter: 


<journaledJDBC journalLogFiles="5"            dataDirectory="${activemq.base}/activemq-data"            dataSource="#mysql-ds"/>   

Uncomment the mysql-ds datasource (update the MySQL username/password): 
<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="root"/>    <property name="password" value=""/>

     <property name="poolPreparedStatements" value="true"/>

Get the MySQL Java Connector (aka the driver). Add the connector jar file
to the activemq’s classpath (just copy this jar to the activemq’s lib/optional folder. Launch the MySQL command line program and create a database for ActiveMQ to use: create database activemq;
You can now start the broker using the xbean option:
./bin/activemq xbean:./conf/my-activemq.xml
The broker (aka JMS server) should start without a problem. You can verify that it using the database. Check the activemq database and you’ll see that 3 new tables have been created:
     mysql> use activemq; show tables;Database changed


| Tables_in_activemq |




| activemq_msgs      |


3 rows in set (0.00 sec)    
Also visit the ActiveMQ’s admin console on http://localhost:8161/ to make sure that all is well.


Filed Under: Active MQ

TextBox widget example - adding any formatted HTML code to the widget.

Comment List

  • None

Month List