...
|
...
|
@@ -97,7 +97,7 @@ func (r *Runer) InitConsumer() error { |
|
|
config := sarama.NewConfig()
|
|
|
config.Consumer.Group.Rebalance.Strategy = sarama.BalanceStrategyRoundRobin
|
|
|
config.Consumer.Offsets.Initial = sarama.OffsetNewest
|
|
|
config.Version = sarama.V0_11_0_2
|
|
|
config.Version = sarama.V0_10_2_1
|
|
|
consumerGroup, err := sarama.NewConsumerGroup(r.msgConsumer.kafkaHosts, r.msgConsumer.groupId, config)
|
|
|
if err != nil {
|
|
|
return err
|
...
|
...
|
@@ -119,8 +119,6 @@ func (r *Runer) Start(ctx context.Context) { |
|
|
r.consumerGroup.Close()
|
|
|
return
|
|
|
default:
|
|
|
|
|
|
}
|
|
|
if err := r.consumerGroup.Consume(ctx, r.msgConsumer.topics, r.msgConsumer); err != nil {
|
|
|
logs.Error("consumerGroup err:%s \n", err)
|
|
|
//等待重试
|
...
|
...
|
@@ -129,6 +127,8 @@ func (r *Runer) Start(ctx context.Context) { |
|
|
}
|
|
|
r.msgConsumer.ready = make(chan struct{})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
func (r *Runer) IsReady() <-chan struct{} {
|
|
|
return r.msgConsumer.ready
|
...
|
...
|
|