ActiveMQ.xml文件默认位置位于 activemq/conf/目录下,主要的配置及解析如下:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.org/config/1.0"
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.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring>

<!-- persistent="true"表示要持久化存储消息,和子元素persistenceAdapter结合使用 -->
<!-- dataDirectory默认的存储持久化数据的目录 -->
<!-- brokerName 设置broker的name,在注意在网络上必须是唯一的-->
<!-- 更多参考http://activemq.apache.org/xbean-xml-reference-50.html#XBeanXMLReference5.0-brokerelement -->
<broker xmlns="http://activemq.org/config/1.0" brokerName="192.168.1.148" persistent ="true" dataDirectory="${activemq.base}/data" useShutdownHook="false">

<!-- Destination specific policies using destination names or wildcards -->
<!-- wildcards意义见http://activemq.apache.org/wildcards.html -->
<destinationPolicy>
<policyMap>
<policyEntries>
<!-- 这里使用了wildcards,表示所有以EUCITA开头的topic -->
<policyEntry topic="EUCITA.>" producerFlowControl="false" memoryLimit="10mb">
<!-- 分发策略 -->
<dispatchPolicy>
<!-- 按顺序分发 -->
<strictOrderDispatchPolicy/>
</dispatchPolicy>
<!-- 恢复策略-->
<subscriptionRecoveryPolicy>
<!-- 只恢复最后一个message -->
<lastImageSubscriptionRecoveryPolicy/>
</subscriptionRecoveryPolicy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>

<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://192.168.1.148:61616" discoveryUri="multicast://default"/>
<transportConnector name="ssl" uri="ssl://192.168.1.148:61617"/>
<transportConnector name="stomp" uri="stomp://192.168.1.148:61613"/>
<transportConnector name="xmpp" uri="xmpp://192.168.1.148:61222"/>
</transportConnectors>

<!-- 消息持久化方式 -->
<persistenceAdapter>
<amqPersistenceAdapter directory="${activemq.base}/data"/>
</persistenceAdapter>
</broker>

<!-- lets create a command agent to respond to message based admin commands on the ActiveMQ.Agent topic -->
<commandAgent xmlns="http://activemq.org/config/1.0"/>

<!-- An embedded servlet engine for serving up the Admin console -->
<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
<connectors>
<nioConnector port="8161" />
</connectors>

<handlers>
<webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true" />
<webAppContext contextPath="/demo" resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true" />
</handlers>
</jetty>
</beans>

【DispathPolicy】
ActiveMQ支持3中不同的分发策略(避免翻译了以后误解,这里用原文):

1.<roundRobinDispatchPolicy>:Simple dispatch policy that sends a message to every subscription that matches the message.
2.<simpleDispatchPolicy>:Simple dispatch policy that sends a message to every subscription that matches the message.
3.<strictOrderDispatchPolicy>:Dispatch policy that causes every subscription to see messages in the same order.

【SubscriptionRecoveryPolicy】
ActiveMQ支持6种恢复策略,可以自行选择使用不同的策略:

<fixedCountSubscriptionRecoveryPolicy>: keep a fixed count of last messages.
<fixedSizedSubscriptionRecoveryPolicy>: keep a fixed amount of memory available in RAM for message history which is
evicted in time order.
<lastImageSubscriptionRecoveryPolicy>:only keep the last message.
<noSubscriptionRecoveryPolicy>:disable recovery of messages.
<queryBasedSubscriptionRecoveryPolicy>:perform a user specific query mechanism to load any messages they may have missed.
<timedSubscriptionRecoveryPolicy>:keep a timed buffer of messages around in memory and use that to recover new subscriptions.

【PersistenceAdapter】
http://activemq.apache.org/persistence 讲解了关于persistence的信息。ActiveMQ5.2使用AMQ Message Store 持久化消息,这种方式提供了很好的性能(The AMQ Message Store is an embeddable transactional message storage solution that is extremely fast and reliable.) 默认使用该存储方式即可,如果想使用JDBC来存储,可以查找文档配置。

ActiveMQ.xml文件的主要配置的更多相关文章

  1. MyEclipse/Eclipse中XML文件的格式化配置

    Eclipse中XML文件的格式化配置 MyEclipse: 这一步的配置是使格式化的效果为控件的每个属性配置占一行.进入 Window/Preferences,展开到 XML/XML Resourc ...

  2. maven的setting.xml文件中只配置本地仓库路径的方法

    maven的setting.xml文件中只配置本地仓库路径的方法 即:settings标签下只有一个 localRepository标签,其他全部注释掉即可 <?xml version=&quo ...

  3. 【MyBatis学习05】SqlMapConfig.xml文件中的配置总结

    经过上两篇博文的总结,对mybatis中的dao开发方法和流程基本掌握了,这一节主要来总结一下mybatis中的全局配置文件SqlMapConfig.xml在开发中的一些常用配置,首先看一下该全局配置 ...

  4. 读取xml文件中的配置参数实例_java - JAVA

    文章来源:嗨学网 敏而好学论坛www.piaodoo.com 欢迎大家相互学习 paras.xml文件 <?xml version="1.0" encoding=" ...

  5. WinForm中使用XML文件存储用户配置及操作本地Config配置文件

    大家都开发winform程序时候会大量用到配置App.config作为保持用户设置的基本信息,比如记住用户名,这样的弊端就是每个人一些个性化的设置每次更新程序的时候会被覆盖. 故将配置文件分两大类: ...

  6. SSH项目web.xml文件的常用配置【struts2的过滤器、spring监听器、解决Hibernate延迟加载问题的过滤器、解决中文乱码的过滤器】

    配置web.xml(struts2的过滤器.spring监听器.解决Hibernate延迟加载问题的过滤器.解决中文乱码的过滤器) <!-- 解决中文乱码问题 --> <filter ...

  7. Eclipse中XML文件自定义格式化配置

    1,编码格式:UTF-8 2,Line Width:90,Indent using spaces:2 3,默认编辑器 当添加Spket插件后,xml文件默认编辑器将被修改为Spket,要求恢复默认,则 ...

  8. Spring MVC静态资源处理(在applicationContex.xml文件中进行配置)

    优雅REST风格的资源URL不希望带 .html 或 .do 等后缀.由于早期的Spring MVC不能很好地处理静态资源,所以在web.xml中配置DispatcherServlet的请求映射,往往 ...

  9. Spring_使用XML文件的方式配置事务

    步骤: 正常配置jdbctemplate 正常配置bean 配置事物管理器 配置事物管理器 配置aop切入点,通过切入点把事物链接起来 思路: 接着上一个买书的例子吧,直接拷到新包下,把注解都干掉,需 ...

随机推荐

  1. spring中配置jndi数据源

    spring  AplicationContext.xml中的配置 <bean id="dataSource1" class="org.springframewor ...

  2. Rsync文件同步

    Rsync文件同步 本章结构 关于rsync 1.一款增量备份工具,remote sync,远程同步,支持本地复制或者与其他SSH.rsync主机同步,官方网站:http://rsync.samba. ...

  3. vijos P1037搭建双塔

    P1037搭建双塔 Accepted 标签:动态规划 背包     描述 2001年9月11日,一场突发的灾难将纽约世界贸易中心大厦夷为平地,Mr. F曾亲眼目睹了这次灾难.为了纪念“9?11”事件, ...

  4. Sublime text3 笔记

    打算换个编辑器,以前用dw,在到Aptana,都是比较大的编辑器了,打开的时候都有些慢,久闻sublime text3,小巧轻便,插件丰富,所以决定换下 官网下载地址(ps 之前下载了各种的破解版,总 ...

  5. js 调用php代码

    <?php $test = "var a = ".$_GET['test'].";"; ?> <mce:script type="t ...

  6. 总结一下block的几种常用方法

    一.block的简单介绍 block相当于一个参数,有参数的名,有参数的值,有参数的使用,当使用block的时候,它又相当于一个函数,会回调函数体. 声明:void (^block)(void); 实 ...

  7. jqure全选/取消

    平时我们会遇到全选/全取消, 前台效果: <div class="fix pb40 mt32 ml30 lh22"> <div class="l mr2 ...

  8. Qt获得网页源码

    1.工程中添加网络模块 打开你的.pro文件插入以下代码 QT += network 2.添加代码 CodeQString NetWork::getWebSource(QUrl url) { QNet ...

  9. Windows Phone 8 蓝牙编程

    蓝牙是手机的近距离无限传输的技术,在之前的Windows Phone 7系统手机里面仅支持蓝牙耳机功能,并不支持蓝牙文件信息传输,那么在Windows Phone 8手机里面将全面支持蓝牙技术,并且提 ...

  10. zedboard - 轻量级以太网控制器LWIP

    ipconfig/all route print  显示本机所有的网络 网关是什么 那么网关到底是什么呢?网关实质上是一个网络通向其他网络的IP地址.比如有网络A和网络B,网络A的IP地址范围为&qu ...