poseidon icon indicating copy to clipboard operation
poseidon copied to clipboard

Add an optional response callback to Producer

Open bpot opened this issue 10 years ago • 8 comments

Adds a callback that can be used to determine which messages failed to send and why.

bpot avatar Jul 10 '14 18:07 bpot

Seems cool. Might be worth documenting a use-case somewhere

kerinin avatar Jul 10 '14 18:07 kerinin

@kerinin true. I'll add it to the top-level Producer example

bpot avatar Jul 10 '14 18:07 bpot

@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 avatar Jul 10 '14 18:07 bpot

Coverage Status

Coverage decreased (-0.13%) when pulling d29f06996cff33a5563186f476378a7d417ed577 on bp/response_callback into abbd3dfa13f1a341440d81cc4bdc38f739a57f05 on master.

coveralls avatar Jul 10 '14 18:07 coveralls

@bpot returning an iterator could get complicated with the retries - this seems like a more straightforward approach.

kerinin avatar Jul 10 '14 18:07 kerinin

Having a Callback seems more Ruby-esque, while having a Future that you block on reading the results from feels more 'concurrent'.

atharrison avatar Jul 10 '14 19:07 atharrison

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.

bpot avatar Jul 10 '14 22:07 bpot

Coverage Status

Coverage decreased (-0.01%) when pulling c703749aa512d5e8be7c48a48f335cd10f680be3 on bp/response_callback into abbd3dfa13f1a341440d81cc4bdc38f739a57f05 on master.

coveralls avatar Jul 10 '14 22:07 coveralls