问题描述
我对JMS熟悉,对Google Pub/Sub还是新手.
I am familiar with JMS and novice with Google Pub/Sub.
在JMS中,有2个选项:
In JMS there are 2 options:
- 队列:只有一个消费者可以接受消息.
- 主题:每个消费者都接受来自该主题的每条消息
- Queue: only one consumer can accept message.
- Topic: each consumer accepts each message from the topic
我相信Google Pub/Sub应该支持这样的功能,但是快速谷歌搜索并不能帮助我回答这个问题.
I believe that Google Pub/Sub should support something like this, but a quick Googling didn't help me to answer that question.
请向我指出相应的文档部分.
Please point me out to the corresponding documentation part.
推荐答案
正如名称"Pub/Sub"所示,Google Pub/Sub支持与JMS主题相对应的发布/预订语义.它不支持与JMS队列相对应的点对点语义,至少不直接如此.
As the name "Pub/Sub" indicates, Google Pub/Sub supports publish/subscribes semantics which correspond to JMS topics. It doesn't support point-to-point semantics which correspond to JMS queues, at least not directly.
您可以在文档中查看语义概述. 发布者-订阅者关系"部分可能会有所帮助.需要明确的是,本文档在两个地方确实使用了 queue 这个词:
You can see an overview of the semantics in the documentation. The "Publisher-subscriber relationships" section may be helpful. To be clear, this documentation does use the word queue in two places:
- 在发布/订阅消息流"部分中:订阅者确认消息后,会将其从订阅的消息队列中删除."
- 在常见用例"部分中:例如,可以将大量任务高效地分配给多个工作人员,例如Google Compute Engine实例."
此处的术语 queue 用于指该主题的实际 subscription (即,放置消息以供订阅者使用的位置).此外,建筑概述包括以下图表:该图说明了多个订阅者如何从同一个订阅中接收消息(例如,用于平衡工作负载).这类似于为JMS中的主题添加的共享订阅"功能 2 .
The term queue here is being used to refer to the actual subscription on the topic (i.e. where the messages are placed for subscribers to consume). Furthermore, the architectural overview includes this diagram:This diagram demonstrates how multiple subscribers can receive messages from the same subscription (e.g. for balancing workloads). This would be akin to the "shared subscription" functionality added for topics in JMS 2.
这篇关于Google发布/订阅队列或主题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!