Complete the code to create a Pub/Sub subscription with a dead letter topic.
subscription = pubsub_v1.Subscription(client, project_path, subscription_name, dead_letter_topic=[1])The dead letter topic must be a Pub/Sub topic, specified by its full resource name.
Complete the code to set the maximum delivery attempts for a dead letter policy.
dead_letter_policy = pubsub_v1.types.DeadLetterPolicy(max_delivery_attempts=[1])The max_delivery_attempts must be a positive integer. 5 is a common default.
Fix the error in the dead letter policy assignment by completing the code.
subscription.dead_letter_policy = [1]You must assign the previously created dead_letter_policy object to the subscription.
Fill both blanks to configure a subscription with a dead letter topic and max delivery attempts.
subscription = pubsub_v1.Subscription(client, project_path, subscription_name, dead_letter_policy=pubsub_v1.types.DeadLetterPolicy(dead_letter_topic=[1], max_delivery_attempts=[2]))
The dead letter topic must be the dead letter topic resource name, and max delivery attempts a positive integer like 5.
Fill all three blanks to create a subscription with dead letter policy and acknowledge deadline.
subscription = pubsub_v1.Subscription(client, project_path, subscription_name, dead_letter_policy=pubsub_v1.types.DeadLetterPolicy(dead_letter_topic=[1], max_delivery_attempts=[2]), ack_deadline_seconds=[3])
Dead letter topic is the topic resource name, max delivery attempts is 5, and ack deadline is 20 seconds.