In this article on Google Cloud Pub Sub we are told that a function must return a status to ack receipt of a message. I have one question related specifically to Firebase Cloud Functions pubsub triggers:
I cannot see in the document above how or if a Firebase Cloud function acks the pub sub. Can someone explain this please?
Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.
Cloud Pub/Sub is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a "topic" and other applications can subscribe to that topic to receive the messages.
For Cloud Functions (1st gen): In the Trigger type field, select Cloud Pub/Sub. In the Select a Cloud Pub/Sub topic field, select a topic for the trigger to monitor. Messages published to this topic will trigger calls to your function.
The Pub/Sub server sends each message as an HTTPS request to the subscriber client at a pre-configured endpoint. This request is shown as a PushRequest in the image. The endpoint acknowledges the message by returning an HTTP success status code. A non-success response indicates that Pub/Sub must resend the messages.
This is implemented in Google-managed code. It’s effectively the same as a Pub/Sub push subscription, where a 200 response acks the message (https://cloud.google.com/pubsub/docs/push#receive_push). This auto-ack happens after your function finishes successfully.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With