1
votes

I have a pub/sub topic that I wish to consume from a single cloud function that is deployed in multiple regions. The behaviour that I observe is that all messages get consumed by a single function (ie they all get consumed in one region).

Is there a reason that messages are not being distributed and consumed in other regions?

1
How are you deploying a single cloud function across multiple regions? According to the documentation, Cloud Functions is a regional service.Kamal Aboul-Hosn
Just deploy the same thing, but in the command line specify a different regionpomo

1 Answers

2
votes

It is not possible to have a cross-region Pub/Sub trigger with Cloud Functions given that the service is regional. What this means is that even if the same function is deployed to different regions, they are completely independent. However, if they have the exact same name, then only the first Function created will actually receive messages because the subscription name is unique per Cloud Function name and will be tied to this first deployment. If the functions have different names, then every deployment will create a unique subscription and receive the full stream of messages. We are looking at ways to improve this experience.