0

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?

Antoine
  • 4,456
  • 4
  • 44
  • 51
Arvind Sharma
  • 91
  • 1
  • 7
  • 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 Nov 25 '20 at 17:49

1 Answers1

1

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.

Kamal Aboul-Hosn
  • 15,111
  • 1
  • 34
  • 46
  • So there is no way a dead letter topic can retrieve undelivered messages? – Arvind Sharma Aug 25 '20 at 16:37
  • 1
    What do you mean by "retrieve undelivered messages?" A dead letter topic doesn't retrieve messages; the Pub/Sub service publishes messages to the topic that have exceeded the retry count and then those messages are accessible by creating a subscription on the dead letter topic. – Kamal Aboul-Hosn Aug 25 '20 at 18:19
  • Okay so what I am trying to say is that before a retention period expires I want some mechanism to fetch those undelivered message before it get lost. Is there a way for this ? – Arvind Sharma Aug 26 '20 at 02:23
  • There is not, no. The only way to fetch messages in Pub/Sub is via a subscriber. – Kamal Aboul-Hosn Aug 26 '20 at 10:30
  • re: `lost forever` If you are using your own custom dead letter topic/queue, let me remind you that messages that are sent to a topic with no subscriptions are essentially discarded, so it’s important to have a subscription in place. So perhaps if you made a subscription to your dead letter queue then they wouldn't just disappear on you. – Jesse Chisholm Aug 20 '21 at 20:47
  • @KamalAboul-Hosn Are the undelivered messages go to dead letter topic when retention period expires ? (assuming that the maxRetryCount is not achieved) – user1740131 Jan 24 '23 at 00:50
  • Messages do not go to the dead letter topic if the retention period expires, no. – Kamal Aboul-Hosn Jan 24 '23 at 11:49