DURABLE在queue和topic中的区别
来源:互联网 发布:js继承是什么 编辑:程序博客网 时间:2024/05/16 23:47
DURABLE在queue和topic中的区别
durable是为了防止宕机等异常而导致消息无法及时接收设计的。
这个对queue无太多影响,但对topic影响比较大。
本文引用
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
对queue的影响
Durable queueskeep messages around persistently for any suitable consumer to consumethem. Durable queues do not need to concern themselves with whichconsumer is going to consume the messages at some point in the future.There is just one copy of a message that any consumer in the future canconsume.
对topic的影响
Durable topics however are different as they must logically persistan instance of each suitable message for every durable consumer - sinceeach durable consumer gets their own copy of the message.
对topic影响举例说明
For example imagine a durable subscriber S starts up subscribing totopic T at time D1. Some publisher sends messages M1, M2, M3 to thetopic and S will receive each of these messages. Then S is stopped andthe publisher continues to send M4, M5.
When S restarts at D2, the publisher sends M6 and M7. Now S willreceive M4, M5 followed by M6 and M7 and all future messages. i.e. Swill receive all messages from M1..M7.
This is the difference between durable and non-durable consuming. IfS were a non-durable consumer then it would only have received M1, M2,M3 and M6, M7 - not M4 and M5. i.e. because the subscription isdurable, S will receive every message sent to T whether the subscriberis running or not. For non-durable topics, only messages delivered tothe topic T when S is running are delivered.
So for durable topic subscription, the JMS provider needs to be ableto identify S when it shuts down and later on in the future reconnects,so it can know what messages to send to it while it was not running.JMS specification dictates that the identification of S is done by acombination of the clientID and the durable subscriber name. This is sothat the JMS connection S uses can have many different durablesubscriptions on different topics or on the same topic with differentselectors - yet the JMS provider can know which message for whichsubscription to keep around for it.
So setting the clientID on a JMS connection is vital (along withusing a sensible durable consumer name) for durable topic subscription.Its not an issue for otherQoS
在topic模式下,如果设置durable为true,就要设置clientID给 JMS provider,让他来维护记录 每个订阅者接收消息状态。同时topic的订阅者没接收一条消息也要反馈一条成功接收信息给JMS provider。
- DURABLE在queue和topic中的区别
- DURABLE在queue和topic中的区别
- ActiveMQ在数据中的表说明(queue,durable topic)
- queue和topic的区别
- JSM的topic和queue的区别
- JMS中queue和topic区别
- JMS 服务器ActiveMQ Queue和Topic区别
- JMS Topic 和queue 的区别
- Queue与Topic区别
- Queue与Topic区别
- Queue与Topic区别
- Queue与Topic区别
- Queue与Topic区别
- ActiveMQ Queue和Topic
- topic 和queue的区别和应用 activeMQ
- JMS消息类型模型[queue和topic的区别]
- jms topic与jms queue区别
- jms topic与jms queue区别
- Oracle 11g在ASM磁盘组上添加控制文件
- IOS8 UIAlertController 弹框
- JTable的应用(二)
- Windows系统下一个文件夹里可以放多少个文件?
- JMS学习
- DURABLE在queue和topic中的区别
- cocos2dx3.0自定义回调函数,传递自己想要的参数
- 对jms中Durable Subscription的一种理解
- setWidgetLayoutResource
- java变量的初始化之后的默认值
- 16个很好的在线教育网站
- 泛型的定义及用法
- 年终大学习之软件生命周期
- Unity之一天一个技术点(七)---到包围盒的最近点