kafka-go
kafka-go copied to clipboard
Added SendPartialBatch Setting
Send Partial Batch will force partial batches to send right away when calling Writer.WriteMessages instead of blocking until a full batch is made or the timeout is seen.
I have run into the same issue seen in segmentio/kafka-go#852 this issue and took a whack at implementing a new setting to output batches right away. My implementation is nearly identical to segmentio/kafka-go#1167. Unfortunately I didn't do my homework ahead of time and just re-invented the same solution.
This does add a test to ensure the solution works, and implements the deprecated pattern as well, since it is required in the testing. Further more I removed the unnecessary goroutine which fires the batch after the timeout, since the batch will always flush.