Skip to content

Commit 479d997

Browse files
committed
Add message 'max_bytes' configuration (influxdata#4537)
1 parent 8f895c5 commit 479d997

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

plugins/outputs/kafka/kafka.go

+9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ type (
3737
RequiredAcks int
3838
// MaxRetry Tag
3939
MaxRetry int
40+
// Max Message Bytes
41+
MaxMessageBytes int
4042

4143
Version string `toml:"version"`
4244

@@ -140,6 +142,9 @@ var sampleConfig = `
140142
## until the next flush.
141143
# max_retry = 3
142144
145+
## Max message bytes, should be lower than server message.max.bytes config
146+
# MaxMessageBytes = 0
147+
143148
## Optional TLS Config
144149
# tls_ca = "/etc/telegraf/ca.pem"
145150
# tls_cert = "/etc/telegraf/cert.pem"
@@ -218,6 +223,10 @@ func (k *Kafka) Connect() error {
218223
config.Producer.Retry.Max = k.MaxRetry
219224
config.Producer.Return.Successes = true
220225

226+
if k.MaxMessageBytes > 0 {
227+
config.Producer.MaxMessageBytes = k.MaxMessageBytes
228+
}
229+
221230
// Legacy support ssl config
222231
if k.Certificate != "" {
223232
k.TLSCert = k.Certificate

0 commit comments

Comments
 (0)