From ac357f93eb13299a5cc1a2c1f9e42b2eaad18f78 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Wed, 10 May 2023 12:21:43 +0800 Subject: [PATCH] grpc --- internal/msgtransfer/init.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/msgtransfer/init.go b/internal/msgtransfer/init.go index aaaec4402..cfac23b00 100644 --- a/internal/msgtransfer/init.go +++ b/internal/msgtransfer/init.go @@ -12,9 +12,12 @@ import ( relationTb "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/tx" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" "github.com/OpenIMSDK/openKeeper" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) type MsgTransfer struct { @@ -41,8 +44,9 @@ func StartTransfer(prometheusPort int) error { return err } client, err := openKeeper.NewClient(config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema, - openKeeper.WithFreq(time.Hour), openKeeper.WithUserNameAndPassword(config.Config.Zookeeper.UserName, - config.Config.Zookeeper.Password), openKeeper.WithRoundRobin(), openKeeper.WithTimeout(10)) + openKeeper.WithFreq(time.Hour), openKeeper.WithRoundRobin(), openKeeper.WithUserNameAndPassword(config.Config.Zookeeper.UserName, + config.Config.Zookeeper.Password), openKeeper.WithRoundRobin(), openKeeper.WithTimeout(10), openKeeper.WithOptions(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())), + ) if err != nil { return err }