JBoss 系列八十七: JBoss 中 JMS 消息设定 TimeToLive 的一个误解
来源:互联网 发布:2017阿里云国际版200m 编辑:程序博客网 时间:2024/06/12 18:50
概述
我们在启动JBoss后通常使用如下代码设定消息的TimeToLive
javax.jms.MessageProducer;MessageProducer msgProducer = null;session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);msgProducer = session.createProducer(responseQ);msgProducer.setTimeToLive(Long.valueOf(messageTtl));
但发现消息超过设定的 messageTtl 时间后仍然在消息队列中,所以有人误解为JBoss 中 对 JMS 消息设定 TimeToLive 没有实现。
原因
误解的本身是对JMS标准没有理解准确,TimeToLive意思是当消息队列上有消费者,且消息超过TimeToLive时间没有被消费者消费,则消息被移除,JBoss被异常到ExpirationQueue。如下摘自https://community.jboss.org/wiki/JBMMessageExpiration:
The setTimeToLive() can be used to expire a JMS message. However, the messages would remain on the given destination beyond the time set to expire, if there are no message listeners. The messages sent to any destination with having setTimeToLive() attribute may not expire unless there's a message listener attached to given destination. The messages marked to expire are validated and sent to the ExpiryQueue, at the time of processing by the attached message listener. IOW the messages which remain on the destination beyond the expiry limit, would expire (moved to the ExpiryQueue) by the time a listener is attached to the given destination.
0 0
- JBoss 系列八十七: JBoss 中 JMS 消息设定 TimeToLive 的一个误解
- JBoss 系列六:JBoss 7/WildFly中配置使用JMS消息队列
- JBoss 系列八十四: 使用 JMS session 时的一个误区
- jboss中如何使用jms
- jboss配置使用JMS消息队列
- JBoss的系列配置
- jsf2+spring3+jpa 在jboss 6.1.0上的JMS配置遇到的问题(采用jboss hornetq消息中间件)
- 如何让jboss下的消息驱动bean消费远程JMS消息
- JBoss 系列八十九: JBoss 7/WildFly 中如何阻止一个模块被默认加载
- jms在jboss上的简单应用
- jboss jms开发需要用到的jar
- JBoss和JMS
- JBoss和JMS
- JBoss和JMS
- JBOSS JMS 用户配置
- jboss 和 jms
- Jboss 6 JMS 部署
- JBoss和JMS(转)
- http请求判断网络状态
- Awstats网站日志分析工具
- 在java语言中在byte 字节流读取大于127的情况处理
- Python学习9:函数式编程
- Qt之添加可执行程序图标
- JBoss 系列八十七: JBoss 中 JMS 消息设定 TimeToLive 的一个误解
- 并发访问Access数据库(局域网)
- linux下tftp安装以及使用
- 主函数小结
- java字符串的各种编码转换
- java中subString、split、stringTokenizer三种截取字符串方法的性能比较
- PostgreSQL 实现MySQL 的auto_increment 字段
- Java email
- 发生了下面的代码现场