You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/*
|
|
|
|
** description("").
|
|
|
|
** copyright('open-im,www.open-im.io').
|
|
|
|
** author("fg,Gordon@open-im.io").
|
|
|
|
** time(2021/3/22 15:33).
|
|
|
|
*/
|
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"Open_IM/pkg/common/config"
|
|
|
|
"Open_IM/pkg/common/kafka"
|
|
|
|
"Open_IM/pkg/common/log"
|
|
|
|
"Open_IM/pkg/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
rpcServer RPCServer
|
|
|
|
pushCh PushConsumerHandler
|
|
|
|
pushTerminal []int32
|
|
|
|
producer *kafka.Producer
|
|
|
|
)
|
|
|
|
|
|
|
|
func Init(rpcPort int) {
|
|
|
|
log.NewPrivateLog(config.Config.ModuleName.PushName)
|
|
|
|
rpcServer.Init(rpcPort)
|
|
|
|
pushCh.Init()
|
|
|
|
pushTerminal = []int32{utils.IOSPlatformID, utils.AndroidPlatformID}
|
|
|
|
}
|
|
|
|
func init() {
|
|
|
|
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Run() {
|
|
|
|
go rpcServer.run()
|
|
|
|
go pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&pushCh)
|
|
|
|
}
|