37 lines
861 B
Go
37 lines
861 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"github.com/zeromicro/go-zero/core/conf"
|
|
"github.com/zeromicro/go-zero/core/service"
|
|
"trasfer_middleware/cmd/rpc/internal/config"
|
|
mq2 "trasfer_middleware/cmd/rpc/internal/queue/mq"
|
|
"trasfer_middleware/cmd/rpc/internal/queue/mq/mqServer"
|
|
"trasfer_middleware/cmd/rpc/internal/queue/mq/mqSvc"
|
|
"trasfer_middleware/until/sysLog"
|
|
)
|
|
|
|
var configFile = flag.String("f", "../../../config/transfer.yaml", "the config file")
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
var c config.Config
|
|
conf.MustLoad(*configFile, &c)
|
|
|
|
svcCtx := mqSvc.NewServiceContext(c)
|
|
ctx := context.Background()
|
|
serviceGroup := service.NewServiceGroup()
|
|
defer serviceGroup.Stop()
|
|
res := mq2.AllHandle(&c.Mq, svcCtx, ctx)
|
|
|
|
mqSv := mqServer.NewRocketmq(&c.Mq)
|
|
|
|
err := mqSv.Consume(ctx, res)
|
|
if err != nil {
|
|
sysLog.ErrQueueLog(ctx, err)
|
|
panic(err)
|
|
}
|
|
}
|