123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // Code generated by goctl. DO NOT EDIT!
- // Source: biService.proto
- package main
- import (
- "bp.jydev.jianyu360.cn/BaseService/biService/entity"
- IC "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/config"
- "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/server"
- "bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
- "bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
- "bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/filecenter"
- "flag"
- "fmt"
- "github.com/nsqio/go-nsq"
- "github.com/zeromicro/go-zero/core/conf"
- "github.com/zeromicro/go-zero/core/logx"
- "github.com/zeromicro/go-zero/zrpc"
- "google.golang.org/grpc"
- )
- var configFile = flag.String("f", "etc/biservice.yaml", "the config file")
- func main() {
- flag.Parse()
- conf.MustLoad(*configFile, &IC.IC)
- ctx := svc.NewServiceContext(IC.IC)
- srv := server.NewBiServiceServer(ctx)
- logx.MustSetup(IC.IC.Logx)
- entity.PublicKey = IC.IC.PublicKey
- entity.InitMysql(IC.IC.Mysql.JianYu, IC.IC.Mysql.JyDoc, IC.IC.Mysql.Bi, IC.IC.Mysql.Tidb, IC.IC.Mysql.BiTidb, IC.IC.Mysql.CallTidb, IC.IC.Mysql.BiService)
- entity.InitMail(IC.IC.Mail)
- entity.InitMongo(IC.IC.Mongo.Qfw.MongodbAddr, IC.IC.Mongo.Qfw.DbName, IC.IC.Mongo.Qfw.Size)
- entity.InitBiddingMgo(IC.IC.Mongo.Bidding.MongodbAddr, IC.IC.Mongo.Bidding.DbName, IC.IC.Mongo.Bidding.UserName, IC.IC.Mongo.Bidding.Password, IC.IC.Mongo.Bidding.Size)
- entity.InitQyxyMgo(IC.IC.Mongo.Qyxy.MongodbAddr, IC.IC.Mongo.Qyxy.DbName, IC.IC.Mongo.Qyxy.UserName, IC.IC.Mongo.Qyxy.Password, IC.IC.Mongo.Qyxy.Size)
- entity.InitEs(IC.IC.Es.Version, IC.IC.Es.Address, IC.IC.Es.UserName, IC.IC.Es.Password, IC.IC.Es.DbSize)
- entity.InitEntEs(IC.IC.EntEs.Version, IC.IC.EntEs.Address, IC.IC.EntEs.UserName, IC.IC.EntEs.Password, IC.IC.EntEs.DbSize)
- entity.InitArea()
- entity.InitRedis(IC.IC.RedisAddress)
- entity.InitConfig(IC.IC.ExportDirectory, IC.IC.ComFileDir, IC.IC.UpdateProjectUrl, IC.IC.ExportUrl, IC.IC.ComFileUrl, IC.IC.ExportCount)
- //合力亿捷
- entity.GetHlyj(IC.IC.Hlyj.Appid, IC.IC.Hlyj.Account, IC.IC.Hlyj.Secret, IC.IC.Hlyj.TokenUrl, IC.IC.Hlyj.CallUrl, IC.IC.Hlyj.Integratedid, IC.IC.Hlyj.CallFlag)
- entity.InitMiddleground(IC.IC.RpcServerConf.Etcd.Hosts, IC.IC.ResourceCenterKey)
- entity.FileCenterRpc = filecenter.NewFileCenter(zrpc.MustNewClient(IC.IC.FileCenterRpc))
- entity.OssBucketName = IC.IC.OssBucketName
- entity.OssUrl = IC.IC.OssUrl
- //nsq
- config := nsq.NewConfig()
- consumer, err := nsq.NewConsumer(IC.IC.TopicName, "jy_position_sync", config)
- if err != nil {
- fmt.Println(err)
- }
- consumer.AddHandler(&entity.Handler{})
- err = consumer.ConnectToNSQLookupd(IC.IC.NsqUrl)
- if err != nil {
- fmt.Println(err)
- }
- s := zrpc.MustNewServer(IC.IC.RpcServerConf, func(grpcServer *grpc.Server) {
- pb.RegisterBiServiceServer(grpcServer, srv)
- })
- defer s.Stop()
- fmt.Printf("Starting rpc server at %s...\n", IC.IC.ListenOn)
- s.Start()
- }
|