-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an optional response callback to Producer #46
base: master
Are you sure you want to change the base?
Conversation
# | ||
# @return [Boolean] | ||
def success? | ||
produce_partition_response.error == Poseidon::NO_ERROR_CODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could produce_partition_repsonse.error
ever be nil
? If so, would that mean there was no error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If should only ever be zero if there is no error.
Seems cool. Might be worth documenting a use-case somewhere |
end | ||
end | ||
|
||
# The messages we the produce request sent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in this sentence.
@kerinin true. I'll add it to the top-level Producer example |
@kerinin @atharrison There is also another route that we could go which is providing a future-like object which the user would iterate through once completed. |
@bpot returning an iterator could get complicated with the retries - this seems like a more straightforward approach. |
Having a Callback seems more Ruby-esque, while having a Future that you block on reading the results from feels more 'concurrent'. |
Cool. Just realized this design didn't consider errors that occur before we send the request (like not being able to connect to a leader). I don't know if it makes sense to overload the |
Adds a callback that can be used to determine which messages failed to send and why.