Skip to content

Commit

Permalink
feat: kafka add field to control kafka auto commit offset.
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Apr 28, 2024
1 parent 4d5fb97 commit e92c626
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mq/kafka/sarama.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"github.com/openimsdk/tools/errs"
)

func BuildConsumerGroupConfig(conf *Config, initial int64) (*sarama.Config, error) {
func BuildConsumerGroupConfig(conf *Config, initial int64, autoCommitEnable bool) (*sarama.Config, error) {
kfk := sarama.NewConfig()
kfk.Version = sarama.V2_0_0_0
kfk.Consumer.Offsets.Initial = initial
kfk.Consumer.Offsets.AutoCommit.Enable = autoCommitEnable
kfk.Consumer.Return.Errors = false
if conf.Username != "" || conf.Password != "" {
kfk.Net.SASL.Enable = true
Expand Down

0 comments on commit e92c626

Please sign in to comment.