|
- package kq
-
- import (
- "context"
- "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/pkg/scheduler"
- "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
- )
-
- /*
- *
- Listening to the payment flow status change notification message queue
- */
- type ScheduleHpcMq struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
-
- func NewScheduleHpcMq(ctx context.Context, svcCtx *svc.ServiceContext) *ScheduleHpcMq {
- return &ScheduleHpcMq{
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
-
- func (l *ScheduleHpcMq) Consume(_, val string) error {
- // 接受消息, 根据标签筛选过滤
- hpcSchdl := scheduler.NewHpcScheduler(val)
- schdl, err := scheduler.NewScheduler(hpcSchdl, val)
- if err != nil {
- return err
- }
- schdl.MatchLabels(l.svcCtx.DbEngin)
-
- // 存储数据
- err = schdl.SaveToDb(l.svcCtx.DbEngin)
- if err != nil {
- return err
- }
- return nil
- }
|