0
0
GCPcloud~10 mins

Dead letter topics in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a Pub/Sub subscription with a dead letter topic.

GCP
subscription = pubsub_v1.Subscription(client, project_path, subscription_name, dead_letter_topic=[1])
Drag options to blanks, or click blank then click option'
A"projects/my-project/topics/backup-topic"
B"projects/my-project/topics/main-topic"
C"projects/my-project/subscriptions/dead-letter-subscription"
D"projects/my-project/topics/dead-letter-topic"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a subscription name instead of a topic name for dead letter topic.
Using the main topic as dead letter topic.
2fill in blank
medium

Complete the code to set the maximum delivery attempts for a dead letter policy.

GCP
dead_letter_policy = pubsub_v1.types.DeadLetterPolicy(max_delivery_attempts=[1])
Drag options to blanks, or click blank then click option'
A0
B100
C5
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting max_delivery_attempts to zero disables dead letter handling.
Using negative numbers causes errors.
3fill in blank
hard

Fix the error in the dead letter policy assignment by completing the code.

GCP
subscription.dead_letter_policy = [1]
Drag options to blanks, or click blank then click option'
ADeadLetterPolicy()
Bdead_letter_policy
Cpubsub_v1.types.DeadLetterPolicy()
Dpubsub_v1.DeadLetterPolicy()
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to create a new DeadLetterPolicy without parameters.
Using incorrect module paths.
4fill in blank
hard

Fill both blanks to configure a subscription with a dead letter topic and max delivery attempts.

GCP
subscription = pubsub_v1.Subscription(client, project_path, subscription_name, dead_letter_policy=pubsub_v1.types.DeadLetterPolicy(dead_letter_topic=[1], max_delivery_attempts=[2]))
Drag options to blanks, or click blank then click option'
A"projects/my-project/topics/dead-letter-topic"
B10
C5
D"projects/my-project/topics/main-topic"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the main topic as dead letter topic.
Setting max delivery attempts to zero or negative.
5fill in blank
hard

Fill all three blanks to create a subscription with dead letter policy and acknowledge deadline.

GCP
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])
Drag options to blanks, or click blank then click option'
A"projects/my-project/topics/dead-letter-topic"
B10
C20
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing ack_deadline_seconds with max_delivery_attempts.
Using invalid resource names.