mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
consumer update
This commit is contained in:
parent
7d1b06471f
commit
66c62d8875
@ -24,17 +24,13 @@ type MConsumerGroupConfig struct {
|
|||||||
IsReturnErr bool
|
IsReturnErr bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMConsumerGroup(consumerConfig *MConsumerGroupConfig, topics, addr []string, groupID string) *MConsumerGroup {
|
func NewMConsumerGroup(consumerConfig *MConsumerGroupConfig, topics, addrs []string, groupID string) *MConsumerGroup {
|
||||||
config := sarama.NewConfig()
|
config := sarama.NewConfig()
|
||||||
config.Version = consumerConfig.KafkaVersion
|
config.Version = consumerConfig.KafkaVersion
|
||||||
config.Consumer.Offsets.Initial = consumerConfig.OffsetsInitial
|
config.Consumer.Offsets.Initial = consumerConfig.OffsetsInitial
|
||||||
config.Consumer.Return.Errors = consumerConfig.IsReturnErr
|
config.Consumer.Return.Errors = consumerConfig.IsReturnErr
|
||||||
fmt.Println("init address is ", addr, "topics is ", topics)
|
fmt.Println("init address is ", addrs, "topics is ", topics)
|
||||||
client, err := sarama.NewClient(addr, config)
|
consumerGroup, err := sarama.NewConsumerGroup(addrs, groupID, config)
|
||||||
if err != nil {
|
|
||||||
panic(err.Error())
|
|
||||||
}
|
|
||||||
consumerGroup, err := sarama.NewConsumerGroupFromClient(groupID, client)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user