Skip to content

Commit 702387c

Browse files
burgess001Kou Jiawen
and
Kou Jiawen
authored
add params acks (#126)
Co-authored-by: Kou Jiawen <jiawen.kou@za.group>
1 parent 353d2e8 commit 702387c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

config.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ package main
1616

1717
import (
1818
"fmt"
19-
dto "github.com/prometheus/client_model/go"
20-
"github.com/prometheus/common/expfmt"
21-
"gopkg.in/yaml.v2"
2219
"os"
2320
"strings"
2421
"text/template"
2522

23+
dto "github.com/prometheus/client_model/go"
24+
"github.com/prometheus/common/expfmt"
25+
"gopkg.in/yaml.v2"
26+
2627
"github.com/sirupsen/logrus"
2728
)
2829

@@ -45,6 +46,7 @@ var (
4546
kafkaSaslUsername = ""
4647
kafkaSaslPassword = ""
4748
serializer Serializer
49+
kafkaAcks = "all"
4850
)
4951

5052
func init() {
@@ -111,6 +113,9 @@ func init() {
111113
if value := os.Getenv("KAFKA_SASL_PASSWORD"); value != "" {
112114
kafkaSaslPassword = value
113115
}
116+
if value := os.Getenv("KAFKA_ACKS"); value != "" {
117+
kafkaAcks = value
118+
}
114119

115120
if value := os.Getenv("MATCH"); value != "" {
116121
matchList, err := parseMatchList(value)

main.go

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func main() {
3333
"batch.num.messages": kafkaBatchNumMessages,
3434
"go.batch.producer": true, // Enable batch producer (for increased performance).
3535
"go.delivery.reports": false, // per-message delivery reports to the Events() channel
36+
"acks": kafkaAcks,
3637
}
3738

3839
if kafkaSslClientCertFile != "" && kafkaSslClientKeyFile != "" && kafkaSslCACertFile != "" {

0 commit comments

Comments
 (0)