问题
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:
- In the "Pub/Sub message flow" section: "When a message is acknowledged by the subscriber, it is removed from the subscription's message queue."
- 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