Subscribing to Google PubSub from Function App

Copper Contributor

I'd like to pull Google PubSub messages using a Function App, and I'm trying to understand the best pattern. This is an integration between several systems, and one makes its data available with Google PubSub. 

 

I'd like to pull the messages as continuously as possible, log them, publish them to Azure Service Bus, and then acknowledge each message. 

 

Is this a job for a timer trigger? Maybe run every minute and loop, pulling all available messages? That's the only pattern I see, looking at the Google docs: 

 

https://cloud.google.com/dotnet/docs/reference/Google.Cloud.PubSub.V1/latest/index

https://googleapis.dev/python/pubsub/latest/subscriber/index.html

 

(I don't mind doing this in C# or Python)

 

Google PubSub uses http under these libraries. But it seems like I might be missing a better option in these libraries, like maybe a listener object with a on_message, on_disconnect that I can keep running in an Azure functions, like on a normal messaging system. 

 

 

2 Replies

Want to ask if you have solve the issue, i have a same requirement as you, hope there could be Google PubSub Trigger to make it eaisier@horseatingweeds 

@horseatingweeds Hi1 Have you implemented solution for this task. How did you implement it?
Thanks