Creating pubsub subscription with dead lettering

  • date 31st May, 2021 |
  • by Prwatech |
  • 0 Comments

Handle message failures with Pub/Sub dead lettering

 

Pub/Sub dead lettering is a feature provided by Google Cloud Pub/Sub that allows users to handle message failures effectively by routing problematic messages to a separate dead-letter topic for analysis and troubleshooting. When messages encounter errors during processing, such as delivery failures, exceeding maximum processing attempts, or failing validation checks, dead lettering ensures that these messages are captured and retained for further inspection.

To utilize dead lettering in Pub/Sub, users configure a dead-letter topic and associate it with the original subscription. When a message fails to be processed successfully, Pub/Sub automatically forwards the message to the dead-letter topic instead of discarding it. This enables developers to investigate the root cause of the failure, identify issues within the application or system, and implement necessary fixes or improvements.

By leveraging dead lettering, users can achieve better error handling and fault tolerance in their Pub/Sub message processing pipelines. They can monitor the dead-letter topic for failed messages, analyze error patterns, and implement corrective measures to improve system reliability and resilience.

Prerequisites

GCP account

Open Console.

Open  Menu > Pubsub > Subscriptions

Click on create  Subscription

Give the subscription ID.

Choose the pubsub topic.

the delivery type as push.

Choose the retention period for message. Choose the expiration period.

Give the Acknowledgement time

Tick Enable Dead lettering.

Select a topic for dead lettering.

NB : The topic should not be the same one which we creating subscription.

Give the maximum delivery attempts.

Click create. The subscription created.

Quick Support

image image