Reputation: 145
I am moving from push to pull subscriptions. Given that I have several instances of my service running, during the deployment rollout both push and pull will be in play until all instances are updated. I do not want to loose message events or have events both pushed and pulled. Would it be best practice to simply have separate versions of both topics and subscriptions for pull and then remove the old push ones in a second deployment after the topics are drained? Or is there a better way to do this?
Upvotes: 0
Views: 1185
Reputation: 17161
In transitioning from push to pull, you should not lose any messages; Cloud Pub/Sub handles this transition. However, there would be no way to guarantee that events are not going to be received by both a push subscriber and a pull subscriber during the transition if they are running simultaneously given because Cloud Pub/Sub only has at-least-once delivery guarantees and the transition from push to pull is an eventually consistent change across the system.
If that is a strict requirement, then there are a couple of options:
The choice comes down to a choice between having to update publishers to send messages to a different topic or a transient downtime for processing the messages in the subscribers.
Upvotes: 2