`
annan211
  • 浏览: 445926 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

activemq配置

阅读更多
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!-- START SNIPPET: example -->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
        </property>
    </bean>

   <!-- Allows accessing the server log -->
    <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
          lazy-init="false" scope="singleton"
          init-method="start" destroy-method="stop">
    </bean>

    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
	
		<networkConnectors>
			<!--
			<networkConnector uri="static:(tcp://172.16.7.17:61616,tcp://172.16.7.18:61616)" duplex="true"/> 
			
			<networkConnector uri="static:(nio://172.16.7.17:1888,nio://172.16.7.18:1889)" duplex="true"/>
			<networkConnector uri="static:(tcp://172.16.7.17:1883,tcp://172.16.7.18:1883)" duplex="true"/>-->
		</networkConnectors>
		
        <destinationPolicy>
            <policyMap>
              <policyEntries>  
                <policyEntry topic=">" > 
                <!--topic将会在存储空间不足时 暂存50000条消息-->				
                <pendingMessageLimitStrategy>  
                    <constantPendingMessageLimitStrategy limit="50000"/>  
                  </pendingMessageLimitStrategy>  
               </policyEntry>  
			   <!--配置为每个队列、每个Topic配置了一个最大500mb的队列,并且使用了”optimizedDispatch=true”这个策略,该策略会启用优化了的消息分发器,直接减少消息来回时的上下文以加快消息分发速度。-->
               <policyEntry queue=">" producerFlowControl="false" optimizedDispatch="true" memoryLimit="500mb">  
               </policyEntry>  
              </policyEntries>  
            </policyMap>
        </destinationPolicy>


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

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

          <systemUsage>
		    <!--如果broker没有存储空间 将会阻塞生产者3秒,之后如果还是没有空间,将会在生产方抛出异常-->
            <systemUsage sendFailIfNoSpaceAfterTimeout="3000">
                <memoryUsage>
				    <!--此处百分比 为/bin/env 设置的堆栈百分比-->
                    <memoryUsage percentOfJvmHeap="90" />
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="100 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="50 gb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        <transportConnectors>
		    <!--只保留1887 nio的监听-->
			<transportConnector name="auto+nio" uri="auto+nio://0.0.0.0:1887?maximumConnections=20000&amp;wireFormat.maxFrameSize=104857600&amp;org.apache.activemq.transport.nio.SelectorManager.corePoolSize=200&amp;org.apache.activemq.transport.nio.SelectorManager.maximumPoolSize=150"/>
        </transportConnectors>

        <!-- destroy the spring context on shutdown to stop jetty -->
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>

    </broker>

    <import resource="jetty.xml"/>

</beans>
<!-- END SNIPPET: example -->
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics