Skip to content

Add an optional response callback to Producer#46

Open
bpot wants to merge 3 commits into
masterfrom
bp/response_callback
Open

Add an optional response callback to Producer#46
bpot wants to merge 3 commits into
masterfrom
bp/response_callback

Conversation

@bpot

@bpot bpot commented Jul 10, 2014

Copy link
Copy Markdown
Owner

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

Comment thread lib/poseidon/produce_result.rb Outdated

Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Owner Author

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.

@kerinin

kerinin commented Jul 10, 2014

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in this sentence.

@bpot

bpot commented Jul 10, 2014

Copy link
Copy Markdown
Owner Author

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

@bpot

bpot commented Jul 10, 2014

Copy link
Copy Markdown
Owner Author

@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.

@coveralls

Copy link
Copy Markdown

Coverage Status

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

@kerinin

kerinin commented Jul 10, 2014

Copy link
Copy Markdown

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

@atharrison

Copy link
Copy Markdown
Collaborator

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

@bpot

bpot commented Jul 10, 2014

Copy link
Copy Markdown
Owner Author

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.

@coveralls

Copy link
Copy Markdown

Coverage Status

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants