Install ACTIVEMQ in Mac
Brew Install ACTIVEMQ
Start
ACTIVEMQ start
Console: Enter url:http://localhost:8161/in the browser
A: Persistent to file
This is the default when you install ACTIVEMQ, as long as you set the message to persistent. The configuration and code involved are
<persistenceAdapter>
<KAHADB directory= "${activemq.base}/data/kahadb"/>
</persistenceAdapter>
Producer. Send (Request, msgdeliverymode.persistent, level, timespan.minvalue);
B: Persistent to MySQL
You first need to put the MySQL driver into the activemq Lib directory, I use the file name is: Mysql-connector-java-5.0.4-bin.jar
Next you modify the configuration file
<persistenceAdapter>
<jdbcpersistenceadapter datadirectory= "${activemq.base}/data" datasource= "#derby-ds"/>
</persistenceAdapter>
Increased outside the broker node in the configuration file
<bean id= "Derby-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= "activemq"/>
<property name= "Password" value= "Activemq"/>
<property name= "maxactive" value= "/>"
<property name= "Poolpreparedstatements" value= "true"/>
</bean>
From the configuration you can see that the name of the database is ACTIVEMQ, you need to manually add this library in MySQL.
And then restart Message Queuing, and you'll find 3 more sheets.
1:activemq_acks
2:activemq_lock
3:activemq_msgs
C: Persistent to Oracle
and persistent as MySQL.
ActiveMQ Persistent Configuration