active mq 简单配置

—恢复内容开始—

在activemq.xml 配置activemq的响应配置:

     配置消息持久化:

        <persistenceAdapter>
             <!– <kahaDB directory=”${activemq.data}/kahadb”/> –>
            <jdbcPersistenceAdapter dataSource=”#mysql-ds”/>
        </persistenceAdapter>

 

        <bean id=”mysql-ds” class=”org.apache.commons.dbcp2.BasicDataSource” destroy-method=”close”>
           <property name=”driverClassName” value=”com.mysql.jdbc.Driver”/>
           <property name=”url” value=”jdbc:mysql://localhost:3306/mymq?relaxAutoCommit=true”/>
           <property name=”username” value=”root”/>
           <property name=”password” value=”root”/>
           <property name=”poolPreparedStatements” value=”true”/>
        </bean>

     数据库自动生成:activemq_acks,activeme_lock,activemq_msgs三张表

   

 配置用户名密码设置:

        <plugins>
   <simpleAuthenticationPlugin>
    <users>
     <authenticationUser username=”ruidongfei” password=”ruidongfei” groups=”users,admins”/>
    </users>
   </simpleAuthenticationPlugin>
        </plugins>

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ActiveMqPro.NAME, ActiveMqPro.PASSWORD,ActiveMqPro.AC_MQ_URL);

 

—恢复内容结束—

在activemq.xml 配置activemq的响应配置:

     配置消息持久化:

        <persistenceAdapter>
             <!– <kahaDB directory=”${activemq.data}/kahadb”/> –>
            <jdbcPersistenceAdapter dataSource=”#mysql-ds”/>
        </persistenceAdapter>

 

        <bean id=”mysql-ds” class=”org.apache.commons.dbcp2.BasicDataSource” destroy-method=”close”>
           <property name=”driverClassName” value=”com.mysql.jdbc.Driver”/>
           <property name=”url” value=”jdbc:mysql://localhost:3306/mymq?relaxAutoCommit=true”/>
           <property name=”username” value=”root”/>
           <property name=”password” value=”root”/>
           <property name=”poolPreparedStatements” value=”true”/>
        </bean>

     

   

 配置用户名密码设置:

        <plugins>
   <simpleAuthenticationPlugin>
    <users>
     <authenticationUser username=”ruidongfei” password=”ruidongfei” groups=”users,admins”/>
    </users>
   </simpleAuthenticationPlugin>
        </plugins>

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ActiveMqPro.NAME, ActiveMqPro.PASSWORD,ActiveMqPro.AC_MQ_URL);

 

    原文作者:mysql
    原文地址: https://www.cnblogs.com/CoderRdf/p/activeMQ.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞