JMS pub/sub 域中的发送方接收方可用性

Sender receiver availability in JMS pub/sub domain

Here it states "the sender and the receiver do not have to be available at the same time in order to communicate.". And here 它声明在 pub/sub 域 "A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages." 中。对我来说,斜体字的陈述似乎与第一条陈述相矛盾("the sender and the receiver do not have to be available at the same time")。

如果订阅者必须继续处于活动状态才能消费消息,这意味着发送者和接收者必须同时可用至少在pub/sub领域。如果它们必须可用,那么 pub/sub 域仅与 RMI 一样好。这是真的吗?

...the sender and the receiver do not have to be available at the same time in order to communicate.

据我所知,这是关于 消息传递 的一般性陈述,而不是对 JMS API 提供的语义的细致解释。请注意,在开始对 JMS API 进行具体讨论之前,它位于 "What Is Messaging?" 标题下。

值得一提的是,如果您使用 point-to-point 消息传递风格,JMS API 确实提供了这些语义(也在教程中讨论)。它还使用 pub-sub 消息传递风格提供了这些语义的变体,但我稍后会讲到。

A client that subscribes to a topic can consume only messages published after the client has created a subscription, and the subscriber must continue to be active in order for it to consume messages.

如果您阅读之后的下一句,您会发现一些重要的附加细节:

The JMS API relaxes this timing dependency to some extent by allowing subscribers to create durable subscriptions, which receive messages sent while the subscribers are not active.

因此,正如我之前提到的,您可以通过持久订阅使用 pub-sub 消息传递样式来获得非活动 sender/receiver 语义的变体。

请记住,您引用的文档只是一个教程。它不是 JMS 规范。我怀疑教程的措辞是否受到了与规范相同的审查,因此您更有可能发现模棱两可的陈述。