transfer_middleware/cmd/rpc/queue/queue.go

37 lines
861 B
Go
Raw Normal View History

2024-06-12 13:46:14 +08:00
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)
2024-06-18 16:34:14 +08:00
err := mqSv.Consume(ctx, res)
2024-06-12 13:46:14 +08:00
if err != nil {
2024-06-18 16:34:14 +08:00
sysLog.ErrQueueLog(ctx, err)
2024-06-12 13:46:14 +08:00
panic(err)
}
}