- 浏览: 1578252 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (289)
- java 语法基础 (51)
- spring (8)
- mvc struct /Ant --build.xml (8)
- SOA (0)
- oracle 9i/10g (23)
- sql server 2000-2005 (3)
- 数据库基础知识 (6)
- 设计模式与软件架构 (10)
- Hibernate 持久化 (9)
- J2SE/J2EE/J2ME/AJAX 技术 (8)
- JSF 技术 (3)
- JAVA 图形化 (0)
- JMS (40)
- Eclipse 3.2 IDE 开发技巧 (13)
- 项目处理方法集合 (2)
- html/jsp/javascript (2)
- Unix/Linux (9)
- j2me/ARM/windriver/嵌入式 (4)
- 电信科学 (8)
- jsp (1)
- c/c++ (1)
- LZW压缩算法(java) (2)
- Android (77)
- 版本管理git/svn (2)
最新评论
-
huihai:
有demo吗?
NamingStrategy实现动态表名映射 -
cangbaotu:
推荐给大家一些有用的爬虫源码:https://github.c ...
网络爬虫(源代码参考) -
tuspark:
除了.classpath文件以外,.project文件也应该了 ...
Eclipse .classpath文件浅谈 -
tuspark:
造成eclipse自动关闭的原因有很多,这里有很多介绍:ecl ...
eclipse 自动关闭 解决方案 -
DEMONU:
网上都是这些,这种文章。。。
ActiveMQ中的消息持久性
ActiveMQ in Action(3)
关键字: activemq
2.3 Persistence
2.3.1 AMQ Message Store
AMQ Message Store是ActiveMQ5.0缺省的持久化存储。Message commands被保存到transactional journal(由rolling data logs组成)。Messages被保存到data logs中,同时被reference store进行索引以提高存取速度。Date logs由一些单独的data log文件组成,缺省的文件大小是32M,如果某个消息的大小超过了data log文件的大小,那么可以修改配置以增加data log文件的大小。如果某个data log文件中所有的消息都被成功消费了,那么这个data log文件将会被标记,以便在下一轮的清理中被删除或者归档。以下是其配置的一个例子:
- <broker brokerName="broker" persistent="true" useShutdownHook="false">
- <persistenceAdapter>
- <amqPersistenceAdapter directory="${activemq.base}/data" maxFileLength="32mb"/>
- </persistenceAdapter>
- </broker>
<broker brokerName="broker" persistent="true" useShutdownHook="false"> <persistenceAdapter> <amqPersistenceAdapter directory="${activemq.base}/data" maxFileLength="32mb"/> </persistenceAdapter> </broker>
Property name | Default value | Comments |
directory | activemq-data | the path to the directory to use to store the message store data and log files |
useNIO | true | use NIO to write messages to the data logs |
syncOnWrite | false | sync every write to disk |
maxFileLength | 32mb | a hint to set the maximum size of the message data logs |
persistentIndex | true | use a persistent index for the message logs. If this is false, an in-memory structure is maintained |
maxCheckpointMessageAddSize | 4kb | the maximum number of messages to keep in a transaction before automatically committing |
cleanupInterval | 30000 | time (ms) before checking for a discarding/moving message data logs that are no longer used |
indexBinSize | 1024 | default number of bins used by the index. The bigger the bin size - the better the relative performance of the index |
indexKeySize | 96 | the size of the index key - the key is the message id |
indexPageSize | 16kb | the size of the index page - the bigger the page - the better the write performance of the index |
directoryArchive | archive | the path to the directory to use to store discarded data logs |
archiveDataLogs | false | if true data logs are moved to the archive directory instead of being deleted |
2.3.2 Kaha Persistence
Kaha Persistence 是一个专门针对消息持久化的解决方案。它对典型的消息使用模式进行了优化。在Kaha中,数据被追加到data logs中。当不再需要log文件中的数据的时候,log文件会被丢弃。以下是其配置的一个例子:
- <broker brokerName="broker" persistent="true" useShutdownHook="false">
- <persistenceAdapter>
- <kahaPersistenceAdapter directory="activemq-data" maxDataFileLength="33554432"/>
- </persistenceAdapter>
- </broker>
<broker brokerName="broker" persistent="true" useShutdownHook="false"> <persistenceAdapter> <kahaPersistenceAdapter directory="activemq-data" maxDataFileLength="33554432"/> </persistenceAdapter> </broker>
2.3.3 JDBC Persistence
目前支持的数据库有Apache Derby, Axion, DB2, HSQL, Informix, MaxDB, MySQL, Oracle, Postgresql, SQLServer, Sybase。
如果你使用的数据库不被支持,那么可以调整StatementProvider 来保证使用正确的SQL方言(flavour of SQL)。通常绝大多数数据库支持以下adaptor:
- org.activemq.store.jdbc.adapter.BlobJDBCAdapter
- org.activemq.store.jdbc.adapter.BytesJDBCAdapter
- org.activemq.store.jdbc.adapter.DefaultJDBCAdapter
- org.activemq.store.jdbc.adapter.ImageJDBCAdapter
也可以在配置文件中直接指定JDBC adaptor,例如:
- <jdbcPersistenceAdapter adapterClass="org.apache.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor"/>
<jdbcPersistenceAdapter adapterClass="org.apache.activemq.store.jdbc.adapter.ImageBasedJDBCAdaptor"/>以下是其配置的一个例子:
- <persistence>
- <jdbcPersistence dataSourceRef=" mysql-ds"/>
- </persistence>
- <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
- <property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
- <property name="username" value="activemq"/>
- <property name="password" value="activemq"/>
- <property name="poolPreparedStatements" value="true"/>
- </bean>
<persistence> <jdbcPersistence dataSourceRef=" mysql-ds"/> </persistence> <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/> <property name="username" value="activemq"/> <property name="password" value="activemq"/> <property name="poolPreparedStatements" value="true"/> </bean>
需要注意的是,如果使用MySQL,那么需要设置relaxAutoCommit 标志为true。
2.3.4 Disable Persistence
以下是其配置的一个例子:
评论
发表评论
-
基于jms使用ActiveMQ实现异步日志功能.消息持久到oracle 10g 数据库
2008-09-18 15:05 9895package askyaya.entity;import j ... -
activemq 重新连接的机制
2008-09-18 14:39 23171最近一个项目要用到ActiveMq,并且需要最大程度的保证消息 ... -
ActiveMQ stop inactivity read check
2008-09-17 16:01 10515You can do the following to fix ... -
WSAD环境下JMS异步通信全攻略 (3)
2008-09-11 14:18 31773.5 消息驱动的Bean 在前文讨论JMS消息接收处理逻 ... -
WSAD环境下JMS异步通信全攻略 (2)
2008-09-11 13:58 3720三、JMS P2P编程 在JMS P2P通信方式中,发送程 ... -
WSAD环境下JMS异步通信全攻略 (1)
2008-09-11 13:57 4628一、JMS基本概念 1.1 P2P通信 1.2 Pub ... -
topicpublisher (jms)
2008-09-10 18:55 2887目的地类型JNDI名字连接工厂类型Topic/Queuejav ... -
ProducerTool /MessageBroker /getConnectionFactoryF
2008-09-10 18:12 2439lib: jms1.1.jar activemq-all-5. ... -
activemq例子代码 发送BytesMessage消息
2008-09-10 13:55 18319import javax.jms.Connection; im ... -
ActiveMQ in Action(7)
2008-09-10 13:44 3910ActiveMQ in Action(7) 关键字 ... -
ActiveMQ in Action(6)
2008-09-10 13:43 3690ActiveMQ in Action(6) 关键字: acti ... -
ActiveMQ in Action(5)
2008-09-10 13:42 3885ActiveMQ in Action(5) 关键字: acti ... -
ActiveMQ in Action(4)
2008-09-10 13:40 3434ActiveMQ in Action(4) 关键字: acti ... -
ActiveMQ in Action(2)
2008-09-10 13:38 4180ActiveMQ in Action(2) 关键字: acti ... -
ActiveMQ in Action(1)
2008-09-10 13:37 5746ActiveMQ in Action(1) 关键字: acti ... -
为ActiveMQ服务器添加简单验证机制
2008-09-09 23:48 4156为ActiveMQ服务器添加简单验证机制 关键字: Java, ... -
Sender/receiver 消息
2008-09-09 20:28 2084Sender:import java.io.BufferedR ... -
activema.xml 配置
2008-09-09 17:44 3772/***作者:andyao,email:andyaoy@gma ... -
JMX 与系统管理
2008-09-08 10:52 1829Java SE 6 新特性: JMX 与系统管理 ... -
ActiveMQ中的消息持久性
2008-09-05 12:24 3342ActiveMQ中的消息持久性 ActiveMQ很 ...
相关推荐
ActiveMQ In Action及其源码 本来想免费提供下载的,但是发现csdn不能选择0积分下载,坑的很
ActiveMQ in Action pdf英文原版加源代码压缩包。 Apache ActiveMQ in Action is a thorough, practical guide to implementing message-oriented systems in Java using ActiveMQ. The book lays out the core of ...
ActiveMQ in Action的开发文档
这是最新版的《ActiveMQ in Action》包括第7、9、11、13等章节
activeMq in action 使用activeMq开发JMS的简单讲述,activeMq in action 使用activeMq开发JMS的简单讲述
ActiveMQ in Action 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
ActiveMQ In Action翻译笔记-更新版2011
activemq in action PDF 英文版 源代码 合二为一,目前好像只有英文版,源代码一起发布的少。我收集到了,分享给大家。 这本书讲得真是不错,英文看起来也不难,希望对你有帮助 。
ActiveMQ In Action的精简版
ActiveMQ 不仅实现了 JMS 规范中定义的所有特性,也额外提供了一些特有且有用的特性。我们会在 3.1 小节详细列说这些特性,并且书中剩余的章节还会继续讨论这些特性。为了演示这些特性,我们创建了两个基于实际业务...
ActiveMQ_in_Action_中文ActiveMQ_in_Action_中文ActiveMQ_in_Action_中文ActiveMQ_in_Action_中文
ActiveMQ in Action
经典的学习ActiveMQ的书籍。这本书讲得真是不错,英文看起来也不难,希望对你有帮助 。
ActiveMQ In Action.zip
ActiveMQ_in_Action.pdf 教程文档
activemq in action - activemq in action
ActiveMQ_in_Action_中文.zip
ActiveMQ+In+Action翻译笔记-+更新版2011.pdf
ActionMQ In Action 就是网上可以下载的那个版本, 不知道作者是谁,和英文版的书应该不是一回事。在原版的基础上增加了书签,可以看的更方便。这本书对ActiveMQ入门到一般的管理非常有帮助。