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. 05. 取SQL分组中的某几行数据

    对表中数据分组,有时只需要某列的聚合值:有时却需要返回整行数据,常用的方法有:子查询.ROW_NUMBER.APPLY,总体感觉还是ROW_NUMBER比较直观.测试数据: if OBJECT_ID( ...

  2. 设置UITableView背景透明/监听cell左边的删除按钮的点击事件

    _tableView = [[UITableView alloc] init]; _tableView.delegate = self; _tableView.dataSource = self; _ ...

  3. 一步步搭建自己的轻量级MVCphp框架-(二)一个国产轻量级框架Amysql源码分析(1)

    这个框架是我一个做PHP的朋友“祥子”介绍给我的,Git地址https://coding.net/u/srar/p/AMP/git 下面从入口文件 总线程 ( index.php )开始进行分析 &l ...

  4. Table of Contents - MongoDB

    Getting Started Installation Installing MongoDB on Windows Installing MongoDB on Linux Introduction ...

  5. 【ERROR】---Error executing "adb devices":ADB server didn't ACK

    搭建环境     ionic emulate android 的时候出现问题 端口占用,找到占用端口的程序,结束进程再启动 重新ionic emulate android 还是报错,闪了一下说fail ...

  6. hdu 5444 Elven Postman(二叉树)——2015 ACM/ICPC Asia Regional Changchun Online

    Problem Description Elves are very peculiar creatures. As we all know, they can live for a very long ...

  7. 教-----------有时候就是那么纠结,教的时候不提问题,好像很懂,最后又来纠缠你!真是ctmb

    A热心满满教导B 几分钟后...B”都懂了“ B几分钟后.又把你叫来.(走过去,您好,我还有个问题,能帮我回答下吗?不耽误你多少时间,) A已经走一段距离 ,   思维已经在别的事情上了,变得好没有耐 ...

  8. 验证证书的安装之外部用户PC

      背景:使用一个域外的用户进行登录并验证   1.         用户登录浏览器下载CA证书或者证书链   2.         下载   3.         安装证书   4.         ...

  9. Photoshop CS6的安装

    Photoshop CS6的安装 文件的现在可以从百度软件中下载 安装方法见参考链接,window版的与之类似,亲测成功 参考链接 Mac版Adobe Photoshop CS6 破解过程 Adobe ...

  10. throws与throw的对比

    1.throws关键字通常被应用在声明方法时,用来指定可能抛出的异常.多个异常可以使用逗号隔开.当在主函数中调用该方法时,如果发生异常,就会将异常抛给指定异常对象.如下面例子所示:public cla ...