poseidon
poseidon copied to clipboard
Add an optional response callback to Producer
Adds a callback that can be used to determine which messages failed to send and why.
Seems cool. Might be worth documenting a use-case somewhere
@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.
Coverage decreased (-0.13%) when pulling d29f06996cff33a5563186f476378a7d417ed577 on bp/response_callback into abbd3dfa13f1a341440d81cc4bdc38f739a57f05 on master.
@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 ProduceResult
for that case or pass a second exception? value to the block.