简体   繁体   English

Google PubSub 和订购信息

[英]Google PubSub and ordering messages

I'm trying to understand a little bit more about how PubSub ordering messages works with a very basic toy example.我试图更多地了解PubSub 订购消息如何与一个非常基本的玩具示例一起使用。 Basically, by using the python examples from the googleapis repo I'm able to publish ordered messages to a topic, and then read them through a subscription with order enabled.基本上,通过使用googleapis存储库中的 python 示例,我能够将有序消息发布到主题,然后通过启用了订单的订阅来阅读它们。

What confuses me is that, if I publish the following set of messages让我感到困惑的是,如果我发布以下一组消息

[
    ("message1", "key1"),
    ("message2", "key1"),
    ("message3", "key1"),
    ("message1", "key2"),
    ("message2", "key2"),
]

When I try to read them through either Pull or StreamingPull, PubSub behaves more of like a queue, and I'm only able to retrieve the init messages当我尝试通过 Pull 或 StreamingPull 读取它们时,PubSub 的行为更像是一个队列,而且我只能检索初始化消息

[
    ("message1", "key1"),
    ("message1", "key2"),
]

Only after I ACK those messages, I can move forward, but then I only get again the message3 and message2 .只有在我确认这些消息后,我才能继续前进,但随后我只会再次message3message2 Does this mean that for a Key X, message M+1 won't be available in the subscriptions until message M is acknowledged?这是否意味着对于密钥 X,消息 M+1 在消息 M 被确认之前不会在订阅中可用?

Is this queue-behaviour expected or am I missing something really obvious?这种排队行为是预期的还是我错过了一些非常明显的东西?

Thank you!谢谢!

The only guarantee around delivery is that for the same ordering key, a subsequent message will not be delivered unless the previous message has been delivered.传递的唯一保证是对于相同的排序键,除非先前的消息已传递,否则不会传递后续消息。 For both pull and streaming pull, the messages may come before an ack or they may only come after an ack, but there are not strong guarantees either way.对于 pull 和 streaming pull,消息可能在 ack 之前出现,或者它们可能只在 ack 之后出现,但是这两种方式都没有强有力的保证。

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

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