Does Google Pub/Sub queue or topic?

给你一囗甜甜゛ 提交于 2020-01-24 00:28:07

问题


I am familiar with JMS and novice with Google Pub/Sub.

In JMS there are 2 options:

  • Queue: only one consumer can accept message.
  • Topic: each consumer accepts each message from the topic

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.


回答1:


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.

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:

  1. In the "Pub/Sub message flow" section: "When a message is acknowledged by the subscriber, it is removed from the subscription's message queue."
  2. In the "Common use cases" section: "For example, a large queue of tasks can be efficiently distributed among multiple workers, such as Google Compute Engine instances."

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.



来源:https://stackoverflow.com/questions/59353759/does-google-pub-sub-queue-or-topic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!