-
Notifications
You must be signed in to change notification settings - Fork 182
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
Use higher level kafka Writer api instead of low level Conn api #206
Conversation
Signed-off-by: Joseph Zemek <joseph@robinhood.com>
Thank you for this PR, it's really valuable. As it introduces a breaking change, we need to be very careful and clean in next Changelog. @cpanato who's written this output will take a look for sure when he can. Thank you to both of you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm the code
/hold to get some confirmation if it can post messages to the kafka, I did not have time to do my own check
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM label has been added. Git tree hash: 607747c8cc33f1ae48f27bea789b494c38a4971a
|
/retest |
I'm trying to trigger the CI, so I'm closing and reopening |
@leogr: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@leogr: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@zemek definitely not, I removed the |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area outputs
What this PR does / why we need it:
If no messages to the kafka broker has been sent within
connections.max.idle.ms
set on the broker (default 10 minutes) then the connection gets closed. The existing way of setting up the kafka connection does not re-open the connection and fails with error messages like:I also think it's an anti-pattern to explicitly set the partition number to write to, this means we cannot balance the load across multiple brokers.
From the kafka-go readme:
To produce messages to Kafka, a program may use the low-level
Conn
API, butthe package also provides a higher level
Writer
type which is more appropriateto use in most cases as it provides additional features:
compared with: https://github.com/segmentio/kafka-go#connection-
The
Conn
type is the core of thekafka-go
package. It wraps around a raw network connection to expose a low-level API to a Kafka server.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: