main.go 806 Bytes
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5
package main

import (
	"fmt"
	"git.hilo.cn/hilo-common/resource/consul"
chenweijian's avatar
chenweijian committed
6
	"git.hilo.cn/hilo-common/resource/redisCli"
hujiebin's avatar
hujiebin committed
7
	"hilo-group/cron"
hujiebin's avatar
hujiebin committed
8
	"hilo-group/domain/service/event_s"
hujiebin's avatar
hujiebin committed
9 10 11 12
	"hilo-group/route"
)

const (
hujiebin's avatar
hujiebin committed
13
	PORT         = 9050
hujiebin's avatar
hujiebin committed
14 15 16 17 18
	RegisterName = "hiloGroup"
	RegisterTag  = "群组中心"
)

func main() {
iamhujiebin's avatar
iamhujiebin committed
19
	redisCli.AddRedisHook()
hujiebin's avatar
hujiebin committed
20
	cron.Init()                                              // 开启定时任务
hujiebin's avatar
hujiebin committed
21
	event_s.EventInit()                                      // 注册事件(内部事件+mysql拟kafka)
chenweijian's avatar
chenweijian committed
22
	redisCli.InitCluster()                                   // redis集群
hujiebin's avatar
hujiebin committed
23 24 25 26
	r := route.InitRouter()                                  // 注册路由
	consul.RegisterToConsul(PORT, RegisterName, RegisterTag) // 服务注册
	r.Run(fmt.Sprintf(":%d", PORT))                          // 启动服务
}