Skip to content

Commit

Permalink
update MQ logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Sep 10, 2024
1 parent 15e5836 commit 585266d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions pkg/common/storage/controller/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache"
"github.com/openimsdk/protocol/push"
"github.com/openimsdk/protocol/sdkws"
"github.com/openimsdk/tools/log"
"github.com/openimsdk/tools/mq/kafka"
)

Expand Down Expand Up @@ -55,5 +56,6 @@ func (p *pushDataBase) DelFcmToken(ctx context.Context, userID string, platformI

func (p *pushDataBase) MsgToOfflinePushMQ(ctx context.Context, key string, userIDs []string, msg2mq *sdkws.MsgData) error {
_, _, err := p.producerToOfflinePush.SendMessage(ctx, key, &push.PushMsgReq{MsgData: msg2mq, UserIDs: userIDs})
log.ZInfo(ctx, "message is push to offlinePush topic", "key", key, "userIDs", userIDs, "msg", msg2mq.String())
return err
}
13 changes: 7 additions & 6 deletions tools/check-component/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"time"

"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/tools/db/mongoutil"
Expand All @@ -27,11 +33,6 @@ import (
"github.com/openimsdk/tools/mq/kafka"
"github.com/openimsdk/tools/s3/minio"
"github.com/openimsdk/tools/system/program"
"io/ioutil"
"log"
"os"
"path/filepath"
"time"
)

const maxRetry = 180
Expand Down Expand Up @@ -65,7 +66,7 @@ func CheckMinIO(ctx context.Context, config *config.Minio) error {
}

func CheckKafka(ctx context.Context, conf *config.Kafka) error {
return kafka.Check(ctx, conf.Build(), []string{conf.ToMongoTopic, conf.ToRedisTopic, conf.ToPushTopic})
return kafka.Check(ctx, conf.Build(), []string{conf.ToMongoTopic, conf.ToRedisTopic, conf.ToPushTopic, conf.ToOfflinePushTopic})
}

func initConfig(configDir string) (*config.Mongo, *config.Redis, *config.Kafka, *config.Minio, *config.Discovery, error) {
Expand Down

0 comments on commit 585266d

Please sign in to comment.