spring 集成activitymq持久化文件怎么设置

 我来答
恒我梦2254
2017-05-31 · TA获得超过127个赞
知道答主
回答量:264
采纳率:33%
帮助的人:65.4万
展开全部
ActiveMQ另问题要软件能挂掉挂掉怕怕挂掉信息给丢所本节析几种持久化式:

、持久化文件
ActiveMQ默认支持种式要发消息设置消息持久化

打安装目录配置文件:

D:\ActiveMQ\apache-activemq\conf\activemq.xml越80行发现默认配置项:

注意使用kahaDB基于文件支持事务消息存储器靠高性能扩展消息存储器

设计初衷使用简单并尽能快KahaDB索引使用transaction log并且所destination使用index测试表明:用于产环境支持1万active connection每connection独立queue该表现已经足矣应付部需求

再发送消息候改变第二参数:

MsgDeliveryMode.Persistent

Message保存式2种
PERSISTENT:保存磁盘consumer消费message删除
NON_PERSISTENT:保存内存消费message清除
注意:堆积消息太能导致内存溢

打产者端发送消息:

wps30F4.tmp

启消费者端同管理界面查看:

wps3105.tmp

发现消息等待没持久化ActiveMQ宕机重启消息丢失我现修改文件持久化重启ActiveMQ消费者仍能够收消息

wps3106.tmp

二、持久化数据库
我支持Mysql例先载mysql-connector-java-5.1.34-bin.jar包放:

D:\ActiveMQ\apache-activemq\lib目录

打并修改配置文件:

复制代码
<beans
xmlns=""
xmlns:xsi=""
xsi:schemaLocation=" /spring-beans.xsd
/activemq-core.xsd">

file:${activemq.conf}/credentials.properties

<bean id="logQuery" class="org.fusesource.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">

<!--
The element is used to configure the ActiveMQ broker.
-->

<!-- The constantPendingMessageLimitStrategy is used to prevent
slow topic consumers to block producers and affect other consumers
by limiting the number of messages that are retained
For more information, see:

-->

<!--
The managementContext is used to configure how ActiveMQ is exposed in
JMX. By default, ActiveMQ uses the MBean server that is started by
the JVM. For more information, see:

-->

<!--
Configure message persistence for the broker. The default persistence
mechanism is the KahaDB store (identified by the kahaDB tag).
For more information, see:

-->

<!--
The systemUsage controls the maximum amount of space the broker will
use before disabling caching and/or slowing down producers. For more information, see:

-->

<!--
The transport connectors expose ActiveMQ over a given protocol to
clients and other brokers. For more information, see:

-->

<!--
Enable web consoles, REST and Ajax APIs and demos
The web consoles requires by default login, you can disable this in the jetty.xml file

Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
-->

J
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式