解决办法一:停止activemq服务,再手动启动(多次一举,因为本来就启动了)
解决办法二:配置activemq服务为手动启动,这样activemq服务就不会随系统启动了,每次要自己启动activemq服务
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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)