Require Kafka 0.10.2.0 or later in kafka_consumer (#6181)
This commit is contained in:
parent
51c1659de8
commit
9bdb3992d5
|
@ -23,8 +23,7 @@ and use the old zookeeper connection method.
|
||||||
# client_id = "Telegraf"
|
# client_id = "Telegraf"
|
||||||
|
|
||||||
## Set the minimal supported Kafka version. Setting this enables the use of new
|
## Set the minimal supported Kafka version. Setting this enables the use of new
|
||||||
## Kafka features and APIs. Of particular interest, lz4 compression
|
## Kafka features and APIs. Must be 0.10.2.0 or greater.
|
||||||
## requires at least version 0.10.0.0.
|
|
||||||
## ex: version = "1.1.0"
|
## ex: version = "1.1.0"
|
||||||
# version = ""
|
# version = ""
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,7 @@ const sampleConfig = `
|
||||||
# client_id = "Telegraf"
|
# client_id = "Telegraf"
|
||||||
|
|
||||||
## Set the minimal supported Kafka version. Setting this enables the use of new
|
## Set the minimal supported Kafka version. Setting this enables the use of new
|
||||||
## Kafka features and APIs. Of particular interest, lz4 compression
|
## Kafka features and APIs. Must be 0.10.2.0 or greater.
|
||||||
## requires at least version 0.10.0.0.
|
|
||||||
## ex: version = "1.1.0"
|
## ex: version = "1.1.0"
|
||||||
# version = ""
|
# version = ""
|
||||||
|
|
||||||
|
@ -143,11 +142,15 @@ func (k *KafkaConsumer) Init() error {
|
||||||
config := sarama.NewConfig()
|
config := sarama.NewConfig()
|
||||||
config.Consumer.Return.Errors = true
|
config.Consumer.Return.Errors = true
|
||||||
|
|
||||||
|
// Kafka version 0.10.2.0 is required for consumer groups.
|
||||||
|
config.Version = sarama.V0_10_2_0
|
||||||
|
|
||||||
if k.Version != "" {
|
if k.Version != "" {
|
||||||
version, err := sarama.ParseKafkaVersion(k.Version)
|
version, err := sarama.ParseKafkaVersion(k.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Version = version
|
config.Version = version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue