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.
Open-IM-Server/internal/push/logic/init.go

40 lines
915 B

4 years ago
/*
** 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"
3 years ago
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/kafka"
3 years ago
"Open_IM/pkg/statistics"
"fmt"
4 years ago
)
var (
3 years ago
rpcServer RPCServer
pushCh PushConsumerHandler
pushTerminal []int32
producer *kafka.Producer
count uint64
4 years ago
)
func Init(rpcPort int) {
3 years ago
4 years ago
rpcServer.Init(rpcPort)
pushCh.Init()
3 years ago
pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID}
4 years ago
}
func init() {
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
statistics.NewStatistics(&count, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", 300), 300)
4 years ago
}
func Run() {
go rpcServer.run()
go pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&pushCh)
}