Open
Conversation
This adds the capability to check if a message has been responded to, by `finish` or `requeue`. It also makes these operations idempotent and NOOP after the first attempt. In addition to this, it also makes `touch` a NOOP when a message has already been responded to. Callers can now unconditinally `finish` or `requeue` without being concerned about any acknowledgemnt that has happened before. Or they can simply check if a message has been responded to or not. For backwards-compatility, the interface method defaults to returning `false`.
chrisparrinello
previously approved these changes
Sep 11, 2024
| void forceFlush(); | ||
|
|
||
| default boolean hasResponded() { | ||
| return false; |
There was a problem hiding this comment.
I don't think I like a default for this.
| private final byte[] data; | ||
| private final String topic; | ||
| private final SubConnection connection; | ||
| private final AtomicBoolean responded = new AtomicBoolean(); |
There was a problem hiding this comment.
I wonder if we want more granular information about the final state of the message like was it finished, requeued, etc.
Author
There was a problem hiding this comment.
@chrisparrinello this is mostly for bringing our library at-par (with respect to this feature) with other ones (go/python)
Adding more granular status, while may be desirable, is a bit out of scope.
blakesmith
previously approved these changes
Sep 11, 2024
Contributor
blakesmith
left a comment
There was a problem hiding this comment.
Looks good to me. Extra semicolon nit, but I think this works.
| public void requeue(int delayMillis) { | ||
| connection.requeue(id, delayMillis); | ||
| if (responded.compareAndSet(false, true)) { | ||
| connection.requeue(id, delayMillis);; |
95d8761
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds the capability to check if a message has been responded to, by
finishorrequeue. It also makes these operations idempotent and NOOP after the first attempt.In addition to this, it also makes
toucha NOOP when a message has already been responded to.Callers can now unconditinally
finishorrequeuewithout being concerned about any acknowledgemnt that has happened before. Or they can simply check if a message has been responded to or not.For backwards-compatility, the interface method defaults to returning
false.