Skip to content

Commit

Permalink
issue-235 minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kotronis-te committed Dec 20, 2023
1 parent f5988d8 commit 2785f0a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/kafka/kafka-consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ type kafka struct {
// NewKafkaMessenger returns an instance of a kafka consumer acting as a messenger server
func NewKafkaMConsumer(kafkaSrv string, topics []*TopicDescriptor) (Srv, error) {
glog.Infof("NewKafkaConsumer")
if err := tools.HostAddrValidator(kafkaSrv); err != nil {
return nil, err
brokers := strings.Split(kafkaSrv, ",")
for i := range brokers {
if err := tools.HostAddrValidator(brokers[i]); err != nil {
return nil, err
}
}

config := sarama.NewConfig()
config.ClientID = "validator" + "_" + strconv.Itoa(rand.Intn(1000))
config.Consumer.Return.Errors = true
config.Version = sarama.V1_1_0_0

brokers := strings.Split(kafkaSrv, ",")

// Create new consumer
master, err := sarama.NewConsumer(brokers, config)
if err != nil {
Expand Down

0 comments on commit 2785f0a

Please sign in to comment.