Hi,
Deadlettering is not working . Followed below steps. Please tell us a solution.
Solved! Go to Solution.
Yes, you're correct. Google Cloud Pub/Sub uses a service account created and managed by Google, the service-{projectId}@gcp-sa-pubsub.iam.gserviceaccount.com
service account, to forward undeliverable messages from a subscription to a dead-letter topic. This is mentioned in the official Google Cloud documentation you've referred to.
The Google-managed service account is the one that needs permission to publish to the dead-letter topic. This is because the Pub/Sub service, not your application or the service account your application uses, is what actually moves the message from the subscription to the dead-letter topic.
To allow the Google-managed service account to publish to the dead-letter topic, you need to grant the roles/pubsub.publisher
role to the service-{projectId}@gcp-sa-pubsub.iam.gserviceaccount.com
service account on the dead-letter topic.
Unfortunately, you can't configure Pub/Sub to use your own service account for dead-lettering. The process of forwarding messages to the dead-letter topic is managed by the Pub/Sub service, not by your application, so it needs to use the service account that is associated with the Pub/Sub service.
Here's how you can grant the required permissions:
service-{projectId}@gcp-sa-pubsub.iam.gserviceaccount.com
).After granting the necessary permissions to the Google-managed service account, the dead-lettering feature should work as expected.