Skip to content

Commit

Permalink
Add message 'max_bytes' configuration (influxdata#4537)
Browse files Browse the repository at this point in the history
  • Loading branch information
otherpirate committed Mar 15, 2019
1 parent b5a6948 commit 6c9550a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/outputs/kafka/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type (
RequiredAcks int
// MaxRetry Tag
MaxRetry int
// Max Message Bytes
MaxMessageBytes int

Version string `toml:"version"`

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

if k.MaxMessageBytes > 0 {
config.Producer.MaxMessageBytes = k.MaxMessageBytes
}

// Legacy support ssl config
if k.Certificate != "" {
k.TLSCert = k.Certificate
Expand Down

0 comments on commit 6c9550a

Please sign in to comment.