[英]JMS Topic queue size always 0
If i post a bunch of messages to a topic where the subscriber is very slow. 如果我将一堆消息发布到订阅者非常慢的主题。 The "Queue Size" in geronimos " JMS Resources" tab stays 0. If I use a JMS Queue instead of the topic, I can see the size growing.
geronimos“JMS资源”选项卡中的“队列大小”保持为0.如果我使用JMS队列而不是主题,我可以看到大小增加。 In both scenarios all messages are delivered.
在两种情况下,都会传递所有消息。
Why does the "Queue Size" of the topic shows always 0? 为什么主题的“队列大小”始终显示为0?
A topic represents the publish-subscribe model, and messages will disappear when no subscriber is listening. 主题表示发布 - 订阅模型,当没有订阅者正在侦听时,消息将消失。 Therefor a query on the topic size is always zero.
因此,对主题大小的查询始终为零。
Topics can have multiple subscribers, so a message can be read on multiple clients "listening" on that topic. 主题可以有多个订阅者,因此可以在多个客户端上“读取”该主题上的消息。
Queues on the other hand will keep the messages until a client asks for the next message. 另一方面,队列将保留消息,直到客户端请求下一条消息。 Here you can query for the size of the currently held amount of messages.
在这里,您可以查询当前持有的消息量的大小。 A message can be picked up only by one client.
消息只能由一个客户端获取。
See also the Basic JMS API concepts by Oracle. 另请参阅Oracle的Basic JMS API概念 。
Described for ideal circumstances, durable topics as well as temporary queues are not considered here. 这里不考虑理想情况,持久性主题以及临时队列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.