0
votes

I have a requirement to track the undelivered messages in PubSub. But when a subscriber to a PubSub Pull subscription is unavailable after the retention period the message will be lost forever from the subscription. It is not been captured by the dead letter topic created for the subscription.

It seems the PubSub only sends a message to a dead letter topic if the number of retries exceeds and the acknowledgement not been received by the subscriber.

Is there a way to push a message to dead letter topic before the message get lost for forever?

1
Arvin, do you just need to be able to store messages for longer than the retention period because you need more time to process the messages or do you actually need the older messages to end up in a separate topic for processing out of band?Kir Titievsky

1 Answers

0
votes

There is no way to send messages to a dead letter topic before the message is deleted due to the retention period expiring, no. The goal of the dead letter topic is to capture messages that are causing issues for subscribers and potentially preventing the processing of other messages, e.g., if the subscribers are crashing due to an unexpected message. The way this state is detected is via the retry count.