message.go 690 B

123456789101112131415161718192021222324252627282930
  1. package service
  2. import (
  3. "context"
  4. "strconv"
  5. "go-common/app/admin/main/aegis/model/databus"
  6. "go-common/library/log"
  7. )
  8. func (s *Service) sendCreateTaskMsg(c context.Context, rid, flowID, dispatchLimit, bizid int64) (err error) {
  9. msg := &databus.CreateTaskMsg{
  10. BizID: bizid,
  11. RID: rid,
  12. FlowID: flowID,
  13. DispatchLimit: dispatchLimit,
  14. }
  15. return s.async.Do(c, func(c context.Context) {
  16. log.Info("start to send msg(%+v)", msg)
  17. for retry := 0; retry < 3; retry++ {
  18. if err = s.aegisPub.Send(c, strconv.Itoa(int(msg.RID)), msg); err == nil {
  19. break
  20. }
  21. }
  22. if err != nil {
  23. log.Error("s.aegisPub.Send error(%v) msg(%+v) ", err, msg)
  24. }
  25. })
  26. }