transfer_middleware/cmd/rpc/queue/queue.go

37 lines
869 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"
)
2024-07-16 18:39:48 +08:00
var configFile = flag.String("f", "../../../config/transfer_produce.yaml", "the config file")
2024-06-12 13:46:14 +08:00
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)
}
}