Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The aim of this change is to introduce a Pubsub-native means of delaying message retry, rather than simply holding the message outstanding, which is the only real means of accomplishing this at the moment. The changes discussed in this issue and introduced from version
0.19.0
were breaking for many people who were calling neitherAck
norNack
upon return fromReceive
as a means of implementing a rudimentary retry delay. This addition would allow them an alternative means of implementing the same functionality with more precision.Calling
Nack
over and over is not an ideal solution for these cases. Good problem statement is seen in this comment on an issue thread in the Java libraryExplanation of changes
Delay
which can be called on aMessage
pointer receivertime.Duration
, representing the desired period of time to wait before retrying delivery of the messagemsg.Delay(30*time.Second)
Delay
simply sets the unexportedretryDelay
delay field of theMessage
struct to the desired wait periodReceive
, the value of the message'sretryDelay
field is checkedackDeadline
modified based on the providedretryDelay
valuemaxAckDeadline
value of 10 minutes, regardless of the provided duration10m
max)Example use case for this new functionality:
Nack
repeatedly and having the message retry over and over, it would be preferable to delay the message retry by a certain period of time and only try again once that specified duration has passed.Related issue threads