With Cloud Pubsub message ordering on a push subscription, if I publish two messages with the same ordering key, say Message #1 and Message #2, will Message #2 only be pushed after Message #1 is acknowledged? Or does ordering mean that Message #2 is guaranteed to be pushed after Message #1 by some infinitesimal time difference even without acknowledgement?
From testing using the publisher.py/subscriber.py tool scripts on github and commenting out the ack call, it seems that answer is that Message #2 is not delivered until Message #1 is acked. But that test was done using pull, so I'm not sure if push works differently.
However, the docs seem to suggest that Message #2 could be delivered before Message #1 is acked:
https://cloud.google.com/pubsub/docs/ordering#receiving_messages_in_order
When the Pub/Sub service redelivers a message with an ordering key,
the Pub/Sub service also redelivers every subsequent message with the
same ordering key, including acknowledged messages. Acknowledge these
messages again.
If there is strict ordering using acks, why would a previous message be redelivered after a subsequent message was ack'ed? Unless the redelivery was explicitly invoked using replay?
That difference is crucial when the subscription handler is a concurrent system.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…