Optional. The name of the topic to which dead letter messages should be
published. Format is projects/{project}/topics/{topic}.The Pub/Sub
service account associated with the enclosing subscription's parent project
(i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
have permission to Publish() to this topic.
The operation will fail if the topic does not exist.
Users should ensure that there is a subscription attached to this topic
since messages published to a topic with no subscriptions are lost.
Optional. The name of the topic to which dead letter messages should be
published. Format is projects/{project}/topics/{topic}.The Pub/Sub
service account associated with the enclosing subscription's parent project
(i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
have permission to Publish() to this topic.
The operation will fail if the topic does not exist.
Users should ensure that there is a subscription attached to this topic
since messages published to a topic with no subscriptions are lost.
Optional. The maximum number of delivery attempts for any message. The
value must be between 5 and 100.
The number of delivery attempts is defined as 1 + (the sum of number of
NACKs and number of times the acknowledgment deadline has been exceeded
for the message).
A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
client libraries may automatically extend ack_deadlines.
This field will be honored on a best effort basis.
If this parameter is 0, a default value of 5 is used.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[],[],null,["# Interface DeadLetterPolicyOrBuilder (1.141.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.141.2 (latest)](/java/docs/reference/google-cloud-pubsub/latest/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.141.1](/java/docs/reference/google-cloud-pubsub/1.141.1/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.140.2](/java/docs/reference/google-cloud-pubsub/1.140.2/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.139.4](/java/docs/reference/google-cloud-pubsub/1.139.4/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.138.0](/java/docs/reference/google-cloud-pubsub/1.138.0/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.137.1](/java/docs/reference/google-cloud-pubsub/1.137.1/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.136.1](/java/docs/reference/google-cloud-pubsub/1.136.1/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.135.0](/java/docs/reference/google-cloud-pubsub/1.135.0/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.134.2](/java/docs/reference/google-cloud-pubsub/1.134.2/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.133.1](/java/docs/reference/google-cloud-pubsub/1.133.1/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.132.2](/java/docs/reference/google-cloud-pubsub/1.132.2/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.131.0](/java/docs/reference/google-cloud-pubsub/1.131.0/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.130.0](/java/docs/reference/google-cloud-pubsub/1.130.0/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.129.6](/java/docs/reference/google-cloud-pubsub/1.129.6/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.127.3](/java/docs/reference/google-cloud-pubsub/1.127.3/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.126.6](/java/docs/reference/google-cloud-pubsub/1.126.6/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.125.13](/java/docs/reference/google-cloud-pubsub/1.125.13/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.123.18](/java/docs/reference/google-cloud-pubsub/1.123.18/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.122.2](/java/docs/reference/google-cloud-pubsub/1.122.2/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.121.1](/java/docs/reference/google-cloud-pubsub/1.121.1/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.120.24](/java/docs/reference/google-cloud-pubsub/1.120.24/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.119.1](/java/docs/reference/google-cloud-pubsub/1.119.1/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.118.0](/java/docs/reference/google-cloud-pubsub/1.118.0/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.117.0](/java/docs/reference/google-cloud-pubsub/1.117.0/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.116.4](/java/docs/reference/google-cloud-pubsub/1.116.4/com.google.pubsub.v1.DeadLetterPolicyOrBuilder)\n- [1.115.5](/java/docs/reference/google-cloud-pubsub/1.115.5/com.google.pubsub.v1.DeadLetterPolicyOrBuilder) \n\n public interface DeadLetterPolicyOrBuilder extends MessageOrBuilder\n\nImplements\n----------\n\n[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)\n\nMethods\n-------\n\n### getDeadLetterTopic()\n\n public abstract String getDeadLetterTopic()\n\nOptional. The name of the topic to which dead letter messages should be\npublished. Format is `projects/{project}/topics/{topic}`.The Pub/Sub\nservice account associated with the enclosing subscription's parent project\n(i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must\nhave permission to Publish() to this topic.\n\nThe operation will fail if the topic does not exist.\nUsers should ensure that there is a subscription attached to this topic\nsince messages published to a topic with no subscriptions are lost.\n\n`string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL];`\n\n### getDeadLetterTopicBytes()\n\n public abstract ByteString getDeadLetterTopicBytes()\n\nOptional. The name of the topic to which dead letter messages should be\npublished. Format is `projects/{project}/topics/{topic}`.The Pub/Sub\nservice account associated with the enclosing subscription's parent project\n(i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must\nhave permission to Publish() to this topic.\n\nThe operation will fail if the topic does not exist.\nUsers should ensure that there is a subscription attached to this topic\nsince messages published to a topic with no subscriptions are lost.\n\n`string dead_letter_topic = 1 [(.google.api.field_behavior) = OPTIONAL];`\n\n### getMaxDeliveryAttempts()\n\n public abstract int getMaxDeliveryAttempts()\n\nOptional. The maximum number of delivery attempts for any message. The\nvalue must be between 5 and 100.\n\nThe number of delivery attempts is defined as 1 + (the sum of number of\nNACKs and number of times the acknowledgment deadline has been exceeded\nfor the message).\n\nA NACK is any call to ModifyAckDeadline with a 0 deadline. Note that\nclient libraries may automatically extend ack_deadlines.\n\nThis field will be honored on a best effort basis.\n\nIf this parameter is 0, a default value of 5 is used.\n\n`int32 max_delivery_attempts = 2 [(.google.api.field_behavior) = OPTIONAL];`"]]