首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

ActiveMQ-剔除不活动的队列(Delete Inactive Destinations)

2013-12-13 
ActiveMQ-删除不活动的队列(Delete Inactive Destinations)broker xmlnshttp://activemq.apache.org/sc

ActiveMQ-删除不活动的队列(Delete Inactive Destinations)
<broker xmlns="http://activemq.apache.org/schema/core" schedulePeriodForDestinationPurge="10000"> <destinationPolicy> <policyMap> <policyEntries> <policyEntry queue=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC="30000"/> </policyEntries> </policyMap> </destinationPolicy> </broker>

schedulePeriodForDestinationPurge:10000 ?每十秒检查一次,默认为0,此功能关闭

?

gcInactiveDestinations: true ?删除掉不活动队列,默认为false

inactiveTimoutBeforeGC:30000 不活动30秒后删除,默认为60秒

?

修改后的完整xml如下:

<beans  xmlns="http://www.springframework.org/schema/beans"  xmlns:amq="http://activemq.apache.org/schema/core"  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-2.0.xsd  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">    <bean schedulePeriodForDestinationPurge="10000" brokerName="localhost" dataDirectory="${activemq.data}">        <destinationPolicy>            <policyMap>              <policyEntries>                <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">                  <pendingSubscriberPolicy>                    <vmCursor />                  </pendingSubscriberPolicy>                </policyEntry>                <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">                </policyEntry><policyEntry queue=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC="30000"/>              </policyEntries>            </policyMap>        </destinationPolicy>        <managementContext>            <managementContext createConnector="false"/>        </managementContext>        <persistenceAdapter>            <kahaDB directory="${activemq.data}/kahadb"/>        </persistenceAdapter>          <systemUsage>            <systemUsage>                <memoryUsage>                    <memoryUsage limit="64 mb"/>                </memoryUsage>                <storeUsage>                    <storeUsage limit="100 gb"/>                </storeUsage>                <tempUsage>                    <tempUsage limit="50 gb"/>                </tempUsage>            </systemUsage>        </systemUsage>        <transportConnectors>            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>        </transportConnectors>    </broker>      <import resource="jetty.xml"/></beans>

?

由于ActiveMQ使用时自动创建Destination,并且默认情况下不会删除掉,这种只增加不减少,导致在queue创建频繁的情况下,本功能非常有用。

?

热点排行