温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

ActiveMQ5.14.5配置参数详解

发布时间:2020-06-19 17:21:07 来源:网络 阅读:5490 作者:乾坤刀 栏目:软件技术

Activemq-.xml
1.加载properties配置参数。下面加载是访问broker的身份信息,即用户名和密码

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
       </property>
    </bean>

2.配置broker.同时brokerName必须唯一

<broker xmlns="http://activemq.apache.org/schema/core"  brokerName="amq-broker" useJmx="true">

3.destination(即queue/topic)的策略
<destinationPolicy></destinationPolicy>

4.限制所有的queue和topic的内存大小;是否开启生产者的流程控制。

<policyEntry queue=">" producerFlowControl="true" memoryLimit="5mb"/>
<policyEntry topic=">" producerFlowControl="true" memoryLimit="5mb">

5.topic类型的分发策略。即一个topic生产的主题,严格按照产生的顺序被消费者接收。并且每个消费者接收的顺序都一样。

<dispatchPolicy>
      <strictOrderDispatchPolicy/>
</dispatchPolicy>

strictOrderDispatchPolicy:严格按照产生的顺序被消费;
simpleDispatchPolicy:
roundRobinDispatchPolicy:
priorityNetworkDispatchPolicy:
priorityDispatchPolicy:

6.topic订阅发现的策略。

 <subscriptionRecoveryPolicy>
     <lastImageSubscriptionRecoveryPolicy/>
 </subscriptionRecoveryPolicy>

7.是否暴露JMX接口。

 <managementContext>
    <managementContext createConnector="false"/>
 </managementContext>

8.broker集群

<networkConnectors>
    <networkConnector uri="static:(tcp://localhost:61616)" duplex="true"/>
</networkConnectors>

9.broker中的消息存储方式

 <persistenceAdapter>
     <kahaDB directory="${activemq.data}/static-broker2/kahadb" />
 </persistenceAdapter>

10.activeMQ对服务器的资源分配

   <systemUsage>
       <systemUsage>
             <memoryUsage>
                 <memoryUsage limit="20 mb"/>
             </memoryUsage>
             <storeUsage>
                 <storeUsage limit="1 gb" name="foo"/>
             </storeUsage>
             <tempUsage>
                <tempUsage limit="100 mb"/>
             </tempUsage>
        </systemUsage>
   </systemUsage>

11.本activeMQ服务对外的协议以及端口

  <transportConnectors>
        <transportConnector name="openwire" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
        <transportConnector name="ssl" uri="ssl://localhost:61617"/>
        <transportConnector name="stomp" uri="stomp://localhost:61613"/>
        <transportConnector name="ws" uri="ws://localhost:61614/" />
  </transportConnectors>

12.ssl访问上下文

 <sslContext>
       <sslContext keyStore="file:${activemq.conf}/broker.ks"
              keyStorePassword="password" trustStore="file:${activemq.conf}/broker.ts"
              trustStorePassword="password"/>
  </sslContext>

13.activeMQ关闭时习销毁spring context

 <shutdownHooks>
     <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
 </shutdownHooks>

14.安全身份设置

    <plugins>
        <simpleAuthenticationPlugin>
            <users>
                <authenticationUser username="system" password="${activemq.password}"
                    groups="users,admins"/>
                <authenticationUser username="user" password="${guest.password}"
                    groups="users"/>
                <authenticationUser username="guest" password="${guest.password}" groups="guests"/>
            </users>
        </simpleAuthenticationPlugin>

      <authorizationPlugin>
        <map>
          <authorizationMap>
            <authorizationEntries>
              <authorizationEntry queue=">" read="admins" write="admins" admin="admins" />
              <authorizationEntry queue="USERS.>" read="users" write="users" admin="users" />
              <authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" />

              <authorizationEntry queue="TEST.Q" read="guests" write="guests" />

              <authorizationEntry topic=">" read="admins" write="admins" admin="admins" />
              <authorizationEntry topic="USERS.>" read="users" write="users" admin="users" />
              <authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" />

              <authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users" write="guests,users" admin="guests,users"/>
            </authorizationEntries>
          </authorizationMap>
        </map>
      </authorizationPlugin>
    </plugins>
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI