添加消息队列消费者并优化租户存储总量更新逻辑
This commit is contained in:
17
main.go
17
main.go
@@ -2,6 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitee.com/red-future---jilin-g/common/log/consts"
|
||||
"gitee.com/red-future---jilin-g/common/message"
|
||||
"gitee.com/red-future---jilin-g/common/mongo"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
"github.com/gogf/gf/v2/os/gtimer"
|
||||
"oss/controller"
|
||||
@@ -10,7 +13,7 @@ import (
|
||||
|
||||
"gitee.com/red-future---jilin-g/common/http"
|
||||
"gitee.com/red-future---jilin-g/common/jaeger"
|
||||
_ "gitee.com/red-future---jilin-g/common/mongo"
|
||||
logService "gitee.com/red-future---jilin-g/common/log/service"
|
||||
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
|
||||
)
|
||||
|
||||
@@ -30,6 +33,18 @@ func main() {
|
||||
}
|
||||
})
|
||||
|
||||
// 启动消息队列消费者
|
||||
if err := message.StartConsumers(ctx, &message.RedisMessageConfig{
|
||||
StreamKey: mongo.LogRedisKey,
|
||||
GroupName: consts.GroupName,
|
||||
ConsumerName: consts.ConsumerName,
|
||||
BatchSize: consts.BatchSize,
|
||||
AutoAck: consts.AutoAck,
|
||||
HandleFunc: logService.OperationLog.AddOperationLog,
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 保持应用运行
|
||||
select {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user