Skip to content

Commit

Permalink
Add version config to kafka utils (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
achichen authored Sep 19, 2022
1 parent dafc9bf commit 053997a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions utils/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,18 @@ func WithErrorHandler(errorHandler func(error)) Option {
errorHandler: errorHandler,
}
}

type versionOption struct {
version sarama.KafkaVersion
}

func (opt *versionOption) apply(cfg *config) {
cfg.saramaConfig.Version = opt.version
}

// WithVersion specified the kafka cluster version to connect to
func WithVersion(version sarama.KafkaVersion) Option {
return &versionOption{
version: version,
}
}

0 comments on commit 053997a

Please sign in to comment.