JMS message persistence: persists ActiveMQ messages to mySql database _ MySQL

Source: Internet
Author: User
JMS message persistence: Persistence of ActiveMQ messages to mySql database ActiveMQ5.8.0 uses kahadb as the default message persistence mode. By using the default persistence mechanism, we cannot directly see how the message persists. The JDBC persistence mechanism provided by ActiveMQ can store persistent information to the database. By viewing the table structure and stored data generated by ActiveMQ in the database, we can better understand the message persistence mechanism. Now we will introduce how to configure activemq to persistently store data in mysql.

1. configure the mySql data source required by activeMQ

To access the mysql database using JDBC, you must configure the database source of the message server. Configure in activemq/apache-activemq-5.8.0/conf/activemq. xml

 
 
  
  
  
  
  
 
InAdd the data source configuration after the node

2. change the default persistence mode of activeMQ.

Comment out the default kahadb in activemq. xml and use jdbc persistence.

 
 
  
 
3. provide mysql drivers

Because of the activeMQ message server, there is no built-in mysql database driver. We need to manually add the mysql driver to the message server.

The method is to copy the driver to the apache-activemq-5.8.0/lib/directory.

After completing the preceding three steps, we can restart the message server and find that activeMQ creates three tables in the database.

Activemq_acks, activemq_lock, and activemq_msgs. So far, the database persistence is complete. I will continue to introduce the meanings and usage of these three tables in my blog later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.