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

Add kafka producer option top set max record size #67

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions transport/kafka/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ func WithMaxAttemptsProducerOption(attempts int) ProducerOption {
return func(p *Producer) { p.config.MaxAttempts = attempts }
}

// WithMaxBatchBytesOption sets the maximum bytes of record size
// kafka producer will try to produce
func WithMaxBatchBytesOption(batchBytes int64) ProducerOption {
return func(p *Producer) { p.config.BatchBytes = int(batchBytes) }
}

// WithQueueCapacityProducerOption sets the internal buffer capacity
// used to cache incoming messages before publishing on kafka
func WithQueueCapacityProducerOption(qc int) ProducerOption {
Expand Down
Loading