Firebase: Can I "not acknowledge" a PubSub message inside a Firebase cloud function?

Viewed 508

I have a Firebase Cloud Function that is triggered by a PubSub message. The function should either consume the message or wait to consume it at a later time.

Is there a way to return from this function without acknowledging the message, so that it will be re-delivered at a later time?

For example, can I return a Message from the cloud function? The docs seem to indicate this is possible, if I'm reading them right:

Returns non-null functions.CloudFunction containing non-null functions.pubsub.Message A Cloud Function which you can export.

1 Answers

When PubSub trigger a function (Firebase or Cloud Function), if the function end correctly, the message is acknowledge. But if the function crash or raise an exception (in summary, an abnormal terminaison) the message not ack and resend immediately.

This retry loop is performed until the message is ack or the message expired (default and maximum TTL of 7 days, minimum is 10 minutes. You can customize the messageRetentionDuration in the subscription)

Related