kafka key

This commit is contained in:
wangchuxiao
2023-05-19 19:43:43 +08:00
parent ca2eee17bc
commit 5fab4d3138
15 changed files with 501 additions and 667 deletions
+2 -3
View File
@@ -1,9 +1,10 @@
package kafka
import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"sync"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/Shopify/sarama"
)
@@ -28,14 +29,12 @@ func NewKafkaConsumer(addr []string, topic string) *Consumer {
consumer, err := sarama.NewConsumer(p.addr, consumerConfig)
if err != nil {
panic(err.Error())
return nil
}
p.Consumer = consumer
partitionList, err := consumer.Partitions(p.Topic)
if err != nil {
panic(err.Error())
return nil
}
p.PartitionList = partitionList