mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-29 22:11:46 +08:00
concurrent consumption of messages
This commit is contained in:
parent
8fe929d8ab
commit
930923e330
@ -28,14 +28,15 @@ func (mc *OfflineHistoryConsumerHandler) Init(cmdCh chan Cmd2Value) {
|
|||||||
go mc.MessagesDistributionHandle()
|
go mc.MessagesDistributionHandle()
|
||||||
mc.cmdCh = cmdCh
|
mc.cmdCh = cmdCh
|
||||||
mc.msgCh = make(chan Cmd2Value, 1000)
|
mc.msgCh = make(chan Cmd2Value, 1000)
|
||||||
if config.Config.ReliableStorage {
|
|
||||||
mc.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = mc.handleChatWs2Mongo
|
|
||||||
} else {
|
|
||||||
mc.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = mc.handleChatWs2MongoLowReliability
|
|
||||||
for i := 0; i < ChannelNum; i++ {
|
for i := 0; i < ChannelNum; i++ {
|
||||||
mc.chArrays[i] = make(chan Cmd2Value, 1000)
|
mc.chArrays[i] = make(chan Cmd2Value, 1000)
|
||||||
go mc.Run(i)
|
go mc.Run(i)
|
||||||
}
|
}
|
||||||
|
if config.Config.ReliableStorage {
|
||||||
|
mc.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = mc.handleChatWs2Mongo
|
||||||
|
} else {
|
||||||
|
mc.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = mc.handleChatWs2MongoLowReliability
|
||||||
|
|
||||||
}
|
}
|
||||||
mc.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V0_10_2_0,
|
mc.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V0_10_2_0,
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschatOffline.Topic},
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschatOffline.Topic},
|
||||||
|
@ -48,14 +48,15 @@ func (och *OnlineHistoryConsumerHandler) Init(cmdCh chan Cmd2Value) {
|
|||||||
go och.MessagesDistributionHandle()
|
go och.MessagesDistributionHandle()
|
||||||
och.cmdCh = cmdCh
|
och.cmdCh = cmdCh
|
||||||
och.msgCh = make(chan Cmd2Value, 1000)
|
och.msgCh = make(chan Cmd2Value, 1000)
|
||||||
if config.Config.ReliableStorage {
|
|
||||||
och.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = och.handleChatWs2Mongo
|
|
||||||
} else {
|
|
||||||
och.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = och.handleChatWs2MongoLowReliability
|
|
||||||
for i := 0; i < ChannelNum; i++ {
|
for i := 0; i < ChannelNum; i++ {
|
||||||
och.chArrays[i] = make(chan Cmd2Value, 1000)
|
och.chArrays[i] = make(chan Cmd2Value, 1000)
|
||||||
go och.Run(i)
|
go och.Run(i)
|
||||||
}
|
}
|
||||||
|
if config.Config.ReliableStorage {
|
||||||
|
och.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = och.handleChatWs2Mongo
|
||||||
|
} else {
|
||||||
|
och.msgHandle[config.Config.Kafka.Ws2mschat.Topic] = och.handleChatWs2MongoLowReliability
|
||||||
|
|
||||||
}
|
}
|
||||||
och.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V0_10_2_0,
|
och.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V0_10_2_0,
|
||||||
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
|
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user