繁体   English   中英

Google Cloud Pub/Sub 具有订购密钥和同一订阅上的多个消费者

[英]Google Cloud Pub/Sub with ordering keys & multiple consumers on same subscription

关于 Cloud Pub/Sub 行为的问题:假设我有一个带有消息排序的主题,以及一个处理消息排序的订阅。 如果我有多个订阅消费者,有没有办法确保同一个消费者总是获得相同排序键的消息? 我基本上是在尝试确定与 Kafka 主题分区类似的并行行为是否可能,以便能够让有状态的消费者处理某个键的所有消息。

根据https://medium.com/google-cloud/google-cloud-pub-sub-ordered-delivery-1e4181f60bc8 ,在订阅上启用“消息排序”并在发布消息时设置OrderingKey pubsub 元数据标签将消息路由到相同OrderingKey的相同订阅者按顺序排列。

Affinity: If there are messages with an ordering key outstanding to a
streaming pull subscriber, then additional messages that are delivered 
are sent to that same subscriber. If no messages are currently outstanding
for an ordering key, the service delivers messages to the last subscriber 
to receive messages for that key on a best-effort basis.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM