Add message 'max_bytes' configuration (#4537)

This commit is contained in:
Mauro Murari 2018-08-13 20:40:18 -03:00 committed by Daniel Nelson
parent 2395413cc8
commit 61513c64b8
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
1 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,8 @@ type (
RequiredAcks int RequiredAcks int
// MaxRetry Tag // MaxRetry Tag
MaxRetry int MaxRetry int
// Max Message Bytes
MaxMessageBytes int
Version string `toml:"version"` Version string `toml:"version"`
@ -140,6 +142,9 @@ var sampleConfig = `
## until the next flush. ## until the next flush.
# max_retry = 3 # max_retry = 3
## Max message bytes, should be lower than server message.max.bytes config
# MaxMessageBytes = 0
## Optional TLS Config ## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem" # tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem" # tls_cert = "/etc/telegraf/cert.pem"
@ -218,6 +223,10 @@ func (k *Kafka) Connect() error {
config.Producer.Retry.Max = k.MaxRetry config.Producer.Retry.Max = k.MaxRetry
config.Producer.Return.Successes = true config.Producer.Return.Successes = true
if k.MaxMessageBytes > 0 {
config.Producer.MaxMessageBytes = k.MaxMessageBytes
}
// Legacy support ssl config // Legacy support ssl config
if k.Certificate != "" { if k.Certificate != "" {
k.TLSCert = k.Certificate k.TLSCert = k.Certificate