ACTIVEMQ Persistent Configuration

Source: Internet
Author: User
Tags message queue apache camel

ACTIVEMQ Persistent Configuration 1 Overview

ACTIVEMQ is an open-source, JMS1.1-compliant, message-oriented (MOM) middleware that provides efficient, scalable, stable, and secure enterprise-class messaging for applications. ACTIVEMQ uses the authorization provided by Apache, and anyone can modify its implementation code.

ACTIVEMQ's design goal is to provide standard, message-oriented, integrated messaging middleware across multiple language and multi-system applications. ACTIVEMQ implements the JMS standard and provides a number of additional features. These additional features include JMX management (Java Management Extensions, Java Management Extensions), master-Slave management (Master/salve, which is one of the cluster patterns, mainly in terms of reliability, when the primary intermediary (agent) fails, Then the agent replaces the primary proxy's location, does not cause the message system to be paralyzed, the message group communicates (the same set of messages is submitted only to one customer for processing), and the ordered message management (ensures that the message is received by the recipient in the order in which it was sent). Message priority (high priority messages are first delivered and processed), deferred subscription messages are received (when a subscription message is published, if the Subscriber does not open the connection, the message mediation submits the previous, unhandled message to the Subscriber when the connection is opened), the receiver is processed too slowly (can use dynamic load balancing, The majority of messages are submitted to the fast-processing receivers, mainly the PTP messages, the virtual receivers (reducing the number of connections to the mediation), the mature message persistence technology (some messages need to be persisted to the database or file system, the information is not lost when the mediation crashes), cursor operations are supported (can handle large messages), Support for message conversion, using Apache Camel can support EIP, using the form of mirror queue to easily monitor the message queue.

< /c13>2 Custom Installation 2.1 Download Address

Download website:

Http://activemq.apache.org/download-archives.html



2.2 Installation Steps

The installation steps are as follows:

1, decompression;

$ TAR-ZXVF apache-activemq-5.9.0-bin.tar.gz
$ cd/bin
$./activemq Start &


Start MQ in the Run Bin directory

2, related configuration, edit/conf/activemq.xml configuration file:

Master and slave Add the following same configuration:

<brokerxmlns= "Http://activemq.apache.org/schema/core" brokername= "localhost" datadirectory= "${activemq.data}" > <!--configuremessage persistence for the broker.
            The default persistence mechanism isthe KAHADB Store (identified by the kahadb tag). For moreinformation, see:http://activemq.apache.org/persistence.html--<persistencead
            apter> <!--<kahadbdirectory= "${activemq.data}/kahadb"/>-- <jdbcpersistenceadapterdatadirectory= "${activemq.data}/mysqldb" datasource= "#mySql" useDatabaseLock= "true"/ > </persistenceAdapter> </broker> <!--mysqldatasource-<beanid = "MYSQL" class= "Org.apache.commons.dbcp.BasicDataSource" > <propertyname= "driverclassname" value= " Com.mysql.jdbc.Driver "/> <propertyname=" url "value=" Jdbc:mysql://192.168.1.101:3306/activemq?relaXautocommit=true "/> <propertyname=" username "value=" root "/> <propertyname=" password "value=" ro
  OT "/> <propertyname=" poolpreparedstatements "value=" true "/> </bean>


2. Start:

Execute/bin directory under ACTIVEMQ

./activemq Start &


3. View the log after startup:

Master:


Slave;

The previous log indicates a successful start.

2.3 Persistence Classification

There are three common ways of ACTIVEMQ persistence

1, kahadb file storage method;

2, the JDBC database storage method;

3 Persistence mode configuration 3.1 kahadb Configuration

1) Default Persistence configuration:

---------------------------------------------------------------------------------------------

<persistenceAdapter>
    <kahadbdirectory= "${activemq.data}/kahadb"/>
</persistenceadapter >

By default, the KAHADB configuration is used; Data files are stored in the/data/directory

3.2 JDBC Database storage method

1) because the data needs to be persisted to the database, the corresponding database driver jar package needs to be put into the bin directory of ACTIVEMQ;

2) Description:

After persistence, 3 tables are generated in the database:

Activemq_acks

Activemq_lock

Activemq_msgs

3) Configuration:

XML code

Mysql:

<persistenceAdapter>
<jdbcpersistenceadapterdatadirectory= "${activemq.base}/data/mysqldb" Datasource= "#mySql"/>
</persistenceAdapter>


The MySQL data source is configured as follows:

<!--MySQL DataSource--
<beanid= "MySQL" class= "Org.apache.commons.dbcp.BasicDataSource" >
     <propertyname= "Driverclassname" value= "Com.mysql.jdbc.Driver"/>
     <propertyname= "url" value= "JDBC: Mysql://127.0.0.1:3306/activemq?relaxautocommit=true "/>
     <propertyname=" username "value=" root "/>
     <propertyname= "Password" value= "root"/>
     <propertyname= "poolpreparedstatements" value= "true"/ >
</bean>


XML code

Oracle:

----------------------------------------------------------------------------------------------

<persistenceAdapter> 
<jdbcpersistenceadapterdatasource= "#oracle-ds"/> 


The Oracle data source is configured as follows:

XML code

<bean id= "Oracle-ds" class= "Org.apache.commons.dbcp.BasicDataSource" destroy-method= "Close" > 
      < Propertyname= "Driverclassname" value= "Oracle.jdbc.driver.OracleDriver"/> 
      <property name= "url" value= " Jdbc:oracle:thin: @localhost: 1521:amqdb "/> 
      <property name=" username "value=" Scott "/> 
      < Property name= "Password" value= "Tiger"/> 
      <property name= "maxactive" value= "$"/> 
      < Propertyname= "Poolpreparedstatements" value= "true"/> 
   


Other data sources are configured to reference ACTIVEMQ documents.

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.