init project
This commit is contained in:
1 parent
d63cc8d9f5
commit
ee07869839
39 files changed
+1560
-622
No files matched your search
@@ -2,11 +2,12 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"git.xiaotuo.co/micro/skeleton/internal/queue/jetstream"
|
||||
"git.xiaotuo.co/pkg/go-plugins/logger"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"micro_layout/internal/logger"
|
||||
"micro_layout/internal/queue/jetstream"
|
||||
)
|
||||
|
||||
type MessageLogic struct {
|
||||
@@ -22,6 +23,9 @@ func (lgc MessageLogic) jetStreamPublish(ctx context.Context, topic string, body
|
||||
WithField("topic", topic).
|
||||
WithField("body", string(body)).
|
||||
Debug("start")
|
||||
if Resources == nil || Resources.JetStreamBroker == nil {
|
||||
return errors.New("jetstream is disabled")
|
||||
}
|
||||
ack, err := Resources.JetStreamBroker.PublishMsg(jetstream.NewMsg(ctx, topic, body))
|
||||
if err != nil {
|
||||
log.WithFields(logger.WithContext(ctx)).
|
||||
|
||||
Reference in new issue
Block a user