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

Q: What is the intended design for fast producers ? #65

Closed
buixor opened this issue Jan 15, 2018 · 2 comments
Closed

Q: What is the intended design for fast producers ? #65

buixor opened this issue Jan 15, 2018 · 2 comments
Labels

Comments

@buixor
Copy link

buixor commented Jan 15, 2018

Hello,
disclaimer : I'm pretty new to both go and kafka

While playing around with kafka-go, I noticed that the WriteMessages() is blocking until it finished delivering messages. Is the expected usage to manage a set of goroutines to ensure fast throughtput, or is there a method I missed in the API to do that ?

Thanks in advance,

@achille-roussel
Copy link
Contributor

The writer configuration has an "Async" boolean property which makes WriteMessages a non-blocking operation see https://godoc.org/github.com/segmentio/kafka-go#WriterConfig.

Keep in mind that in this mode there is no way to know whether the write was successful, if the kafka servers are unreachable or the program exits before the async send happened the messages would get lost.

Your idea of using multiple producer goroutines with blocking WriteMessages calls would also work, and you'd receive an error if producing the messages fail.

@buixor
Copy link
Author

buixor commented Jan 15, 2018

Thanks for the prompt answer !

I will thus stick with goroutines :)

@buixor buixor closed this as completed Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants