-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kgo: use a discard goroutine when produce acks is 0
Kafka proper does *not* reply at all to produce requests when required acks is 0. The client used to wait for responses to this, but this was never actually tested against Kafka itself. The recent fix to **never** read responses for produce requests with acks == 0 actually breaks Microsoft EventHubs when using acks == 0, because MS EH actually still sends produce responses. The "easy" fix for this is, if the client is configured with acks == 0, then we can have a discard goroutine that just drains the connection using a small read buffer. This goroutine is only used for the producer connection, and we expect responses to be small. This also adds a large doc about how it is NOT recommended to use the client for raw kmsg.ProduceRequest's, but also describes how to do so correctly. I do not think that Sarama works against MS EH, because Sarama only reads the connection if acks is non-zero. I think librdkafka works by having a dedicated thread reading the connection always, and when it gets responses, searching for which request to fulfill.
- Loading branch information
Showing
2 changed files
with
155 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters