feat: Add dead lettering max delivery attempts argument#236
feat: Add dead lettering max delivery attempts argument#236leahecole merged 7 commits intogoogleapis:masterfrom
Conversation
Add functionality so users could set max_delivery_attempts while creating or updating a subscription with dead lettering enabled instead of it's value being set to an arbitrary number.
Make the argument optional and set the value to 5 if the user doesn't set it just like Cloud Pub/Sub does.
… with dead lettering calls Added max delivery attempts parameter to calls to update and create subscriber to match the methods in subscriber.py
samples/snippets/subscriber_test.py
Outdated
|
|
||
| subscriber.create_subscription_with_dead_letter_topic( | ||
| PROJECT_ID, TOPIC, SUBSCRIPTION_DLQ, DEAD_LETTER_TOPIC | ||
| PROJECT_ID, TOPIC, SUBSCRIPTION_DLQ, DEAD_LETTER_TOPIC, 10 |
There was a problem hiding this comment.
Question for this line and line 222
- What are the values 10 and 20? Why did we choose them to be 10 and 20 and not whatever the default is?
- If we do need to pass them and not use the default, please use a constant (or two if you want to have the separate values 10&20) like the other arguments passed in the tests - it makes for easier maintenance
There was a problem hiding this comment.
I addressed this in a seperate commit 7ad3b6a.
I added two constants one for the default value and one for the updated one. We could call create subscription with the default value, which is what my new commit does. However, the update subscription call should be called with a new value because we are testing to see if max_delivery_attempts changes after the call.
There was a problem hiding this comment.
LGTM if Tianzi is happy - I'll merge once she's seen it (ping me when that time comes if needed)
There was a problem hiding this comment.
A few nits then LGTM.
samples/snippets/subscriber.py
Outdated
| # TODO(developer): This is an existing dead letter topic that the subscription | ||
| # with dead letter policy will forward dead letter messages to. | ||
| # dead_letter_topic_id = "your-dead-letter-topic-id" | ||
| # TODO(developer): This is an the maximum number of delivery attempts allowed |
There was a problem hiding this comment.
"This is the maximum number of delivery attempts allowed for a message before it gets delivered to a dead letter topic."
There was a problem hiding this comment.
nit: I think you still forgot the cross out "an" in "This is an the"
There was a problem hiding this comment.
Thank you for pointing that out!
samples/snippets/subscriber.py
Outdated
| # TODO(developer): This is an the maximum number of delivery attempts allowed | ||
| # before a message gets dead lettered. | ||
| # max_delivery_attempts = "your-max-delivery-attempts" |
Add optional max_delivery_attempts argument to sample code to more closely resemble Cloud Pub/Sub behavior.
Fixes #235 🦕