Skip to content
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

Poll error callbacks #669

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

ignytis
Copy link

@ignytis ignytis commented Apr 10, 2024

Hello,

This PR adds a callback logic for errors occurred on poll method call in producer. The idea is to handle several kinds of errors immediately.

Here is a use case for this feature. If the application fails to connect or to authenticate to Kafka server then it exits with error code:
https://github.com/ignytis/send2kafka/blob/705f022beb50d8c8be77abbf6e15bd79707e9ebe/src/kafka_producer.rs#L32 <- setting the callback
https://github.com/ignytis/send2kafka/blob/705f022beb50d8c8be77abbf6e15bd79707e9ebe/src/kafka_producer.rs#L8-L13 <- callback itself
This way the connection issues might be handled before trying to send actual messages to the broker.

I'd appreciate any recommendations if there are any option to improve this code or implement this feature the other way.

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.

None yet

1 participant