Merge remote-tracking branch 'origin/errcode' into errcode

# Conflicts:
#	internal/api/auth.go
test-errcode
withchao 2 years ago
commit ebd1de919d

@ -2,7 +2,6 @@ package main
import (
"OpenIM/internal/api"
"OpenIM/internal/api/third"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/log"
"flag"
@ -25,7 +24,6 @@ func main() {
if config.Config.Api.ListenIP != "" {
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
}
go third.MinioInit()
fmt.Println("start api server, address: ", address, ", OpenIM version: ", constant.CurrentVersion)
err := router.Run(address)
if err != nil {

@ -2,7 +2,9 @@ package main
import (
"OpenIM/internal/task"
"OpenIM/internal/tools"
"OpenIM/pkg/common/config"
"context"
"flag"
"fmt"
"time"
@ -22,8 +24,33 @@ func main() {
var userIDFixSeq = flag.String("user_id_fix_seq", "", "userID to Fix Seq")
var superGroupIDFixSeq = flag.String("super_group_id_fix_seq", "", "super groupID to fix Seq")
var fixAllSeq = flag.Bool("fix_all_seq", false, "fix seq")
flag.Parse()
fmt.Println(time.Now(), "start cronTask", *userIDFixSeq, *superGroupIDFixSeq)
task.FixSeq(*userID, *superGroupID, *fixAllSeq)
msgTool, err := tools.InitMsgTool()
if err != nil {
panic(err.Error())
}
ctx := context.Background()
if userIDFixSeq != nil {
msgTool.GetAndFixUserSeqs(ctx, *userIDFixSeq)
}
if superGroupIDFixSeq != nil {
msgTool.FixGroupSeq(ctx, *superGroupIDFixSeq)
}
if fixAllSeq != nil {
msgTool.FixAllSeq(ctx)
}
if userIDClearMsg != nil {
msgTool.ClearUsersMsg(ctx, []string{*userIDClearMsg})
}
if superGroupIDClearMsg != nil {
msgTool.ClearSuperGroupMsg(ctx, []string{*superGroupIDClearMsg})
}
if userIDShowSeq != nil {
msgTool.ShowUserSeqs(ctx, *userIDShowSeq)
}
if superGroupIDShowSeq != nil {
msgTool.ShowSuperGroupSeqs(ctx, *superGroupIDShowSeq)
}
}

@ -2,6 +2,7 @@ package main
import (
"OpenIM/internal/task"
"OpenIM/internal/tools"
"OpenIM/pkg/common/config"
"fmt"
"time"
@ -12,7 +13,7 @@ func main() {
if err := config.InitConfig(); err != nil {
panic(err.Error())
}
if err := task.StartCronTask(); err != nil {
if err := tools.StartCronTask(); err != nil {
panic(err.Error())
}
}

@ -6,7 +6,6 @@ import (
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/log"
"flag"
"fmt"
"sync"
)
@ -18,8 +17,8 @@ func main() {
wg.Add(1)
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "MessageTransferPrometheusPort default listen port")
log.NewPrivateLog(constant.LogFileName)
msgTransfer := msgtransfer.NewMsgTransfer()
fmt.Println("start msg_transfer server ", ", OpenIM version: ", constant.CurrentVersion, "\n")
msgTransfer.Run(*prometheusPort)
if err := msgtransfer.StartTransfer(*prometheusPort); err != nil {
panic(err)
}
wg.Wait()
}

@ -2,30 +2,18 @@ package main
import (
"OpenIM/internal/push"
"OpenIM/internal/startrpc"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/log"
"flag"
"fmt"
"sync"
)
func main() {
if err := config.InitConfig(); err != nil {
panic(err.Error())
}
defaultPorts := config.Config.RpcPort.OpenImPushPort
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "PushrometheusPort default listen port")
flag.Parse()
var wg sync.WaitGroup
wg.Add(1)
log.NewPrivateLog(constant.LogFileName)
fmt.Println("start push rpc server, port: ", *rpcPort, ", OpenIM version: ", constant.CurrentVersion, "\n")
pusher := push.Push{}
if err := pusher.Init(*rpcPort); err != nil {
if err := startrpc.Start(config.Config.RpcPort.OpenImAuthPort[0], config.Config.RpcRegisterName.OpenImAuthName, config.Config.Prometheus.AuthPrometheusPort[0], push.Start); err != nil {
panic(err.Error())
}
pusher.Run(*prometheusPort)
wg.Wait()
}

@ -1,23 +1,15 @@
module OpenIM
go 1.18
go 1.16
require (
firebase.google.com/go v3.13.0+incompatible
github.com/OpenIMSDK/openKeeper v0.9.7
github.com/OpenIMSDK/openKeeper v0.0.1
github.com/OpenIMSDK/open_utils v1.0.8
github.com/Shopify/sarama v1.32.0
github.com/alibabacloud-go/darabonba-openapi v0.1.11
github.com/alibabacloud-go/sts-20150401 v1.1.0
github.com/alibabacloud-go/tea v1.1.17
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/aws/aws-sdk-go-v2 v1.16.7
github.com/aws/aws-sdk-go-v2/config v1.15.14
github.com/aws/aws-sdk-go-v2/credentials v1.12.9
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9
github.com/bwmarrin/snowflake v0.3.0
github.com/dtm-labs/rockscache v0.0.11
github.com/fatih/structs v1.1.0
github.com/gin-gonic/gin v1.8.2
github.com/go-playground/validator/v10 v10.11.1
github.com/go-redis/redis/v8 v8.11.5
@ -53,97 +45,17 @@ require (
require github.com/minio/minio-go v6.0.14+incompatible
require (
cloud.google.com/go v0.105.0 // indirect
cloud.google.com/go/compute v1.13.0 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/firestore v1.9.0 // indirect
cloud.google.com/go/iam v0.8.0 // indirect
cloud.google.com/go/longrunning v0.3.0 // indirect
cloud.google.com/go/storage v1.27.0 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
github.com/alibabacloud-go/openapi-util v0.0.9 // indirect
github.com/alibabacloud-go/tea-utils v1.3.9 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 // indirect
github.com/aws/smithy-go v1.12.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/go-zookeeper/zk v1.0.3 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/google/uuid v1.3.0
github.com/jonboulle/clockwork v0.3.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/klauspost/cpuid v1.3.1 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/lithammer/shortuuid v3.0.0+incompatible // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/minio/md5-simd v1.1.0 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/xid v1.2.1 // indirect
github.com/tjfoc/gmsm v1.3.2 // indirect
github.com/ugorji/go/codec v1.2.8 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/time v0.1.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
replace github.com/Shopify/sarama => github.com/Shopify/sarama v1.29.0

@ -389,8 +389,8 @@ firebase.google.com/go v3.13.0+incompatible/go.mod h1:xlah6XbEyW6tbfSklcfe5FHJIw
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/OpenIMSDK/openKeeper v0.9.7 h1:oWPAsXAHpMpZh8NPB9B8FktVfxk1Ec8tQPdxhzWgh7w=
github.com/OpenIMSDK/openKeeper v0.9.7/go.mod h1:RvyRXEcvWbonkmHLtT8KxGSCNlXY7OfDohhu53E6INU=
github.com/OpenIMSDK/openKeeper v0.0.1 h1:JOz2nEcM/C7PeTnPnfIoYoaFA1X9BVt9W5OWNCDrNlo=
github.com/OpenIMSDK/openKeeper v0.0.1/go.mod h1:RvyRXEcvWbonkmHLtT8KxGSCNlXY7OfDohhu53E6INU=
github.com/OpenIMSDK/open_utils v1.0.8 h1:IopxWgJwEF5ZAPsRuiZZOfcxNOQOCt/p8VDENcHN9r4=
github.com/OpenIMSDK/open_utils v1.0.8/go.mod h1:FLoaQblWUVKQgqt2LrNzfSZLT6D3DICBn1kcOMDLUOI=
github.com/Shopify/sarama v1.29.0 h1:ARid8o8oieau9XrHI55f/L3EoRAhm9px6sonbD7yuUE=
@ -402,57 +402,10 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alibabacloud-go/darabonba-openapi v0.1.7/go.mod h1:6FV1Bt1AItYIlC2rVopPTumrRNtkfPBmrPVAZ8v2bLk=
github.com/alibabacloud-go/darabonba-openapi v0.1.11 h1:w59gtSA0s87p0U5NNG/N/PIHsRP3rtj7qCP9hx9+GL8=
github.com/alibabacloud-go/darabonba-openapi v0.1.11/go.mod h1:MPJMxv7HYrFm5m9uOZWkDYsAWyZztEgnBRfk9Fg0eIU=
github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA=
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50=
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY=
github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
github.com/alibabacloud-go/openapi-util v0.0.8/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
github.com/alibabacloud-go/openapi-util v0.0.9 h1:Z0DP4LFzkM/rW2nxOMiiLoQVZSeE3jVc5jrZ9Fd/UX0=
github.com/alibabacloud-go/openapi-util v0.0.9/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
github.com/alibabacloud-go/sts-20150401 v1.1.0 h1:1yVyKz02ES6aKo3xVjmoPLBH1OAmmSqPkhKRdjEkmYs=
github.com/alibabacloud-go/sts-20150401 v1.1.0/go.mod h1:QW4O/c7Hp4krHYt+6xwnoG8EyZW3V9GYkl6EgIBmxJc=
github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg=
github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
github.com/alibabacloud-go/tea v1.1.15/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
github.com/alibabacloud-go/tea v1.1.17 h1:05R5DnaJXe9sCNIe8KUgWHC/z6w/VZIwczgUwzRnul8=
github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
github.com/alibabacloud-go/tea-utils v1.3.9 h1:TtbzxS+BXrisA7wzbAMRtlU8A2eWLg0ufm7m/Tl6fc4=
github.com/alibabacloud-go/tea-utils v1.3.9/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0+Ih2GY=
github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ=
github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
github.com/aws/aws-sdk-go v1.38.3/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go-v2 v1.16.7 h1:zfBwXus3u14OszRxGcqCDS4MfMCv10e8SMJ2r8Xm0Ns=
github.com/aws/aws-sdk-go-v2 v1.16.7/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
github.com/aws/aws-sdk-go-v2/config v1.15.14 h1:+BqpqlydTq4c2et9Daury7gE+o67P4lbk7eybiCBNc4=
github.com/aws/aws-sdk-go-v2/config v1.15.14/go.mod h1:CQBv+VVv8rR5z2xE+Chdh5m+rFfsqeY4k0veEZeq6QM=
github.com/aws/aws-sdk-go-v2/credentials v1.12.9 h1:DloAJr0/jbvm0iVRFDFh8GlWxrOd9XKyX82U+dfVeZs=
github.com/aws/aws-sdk-go-v2/credentials v1.12.9/go.mod h1:2Vavxl1qqQXJ8MUcQZTsIEW8cwenFCWYXtLRPba3L/o=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 h1:VfBdn2AxwMbFyJN/lF/xuT3SakomJ86PZu3rCxb5K0s=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8/go.mod h1:oL1Q3KuCq1D4NykQnIvtRiBGLUXhcpY5pl6QZB2XEPU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 h1:2C0pYHcUBmdzPj+EKNC4qj97oK6yjrUhc1KoSodglvk=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14/go.mod h1:kdjrMwHwrC3+FsKhNcCMJ7tUVj/8uSD5CZXeQ4wV6fM=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 h1:2J+jdlBJWEmTyAwC82Ym68xCykIvnSnIN18b8xHGlcc=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 h1:QquxR7NH3ULBsKC+NoTpilzbKKS+5AELfNREInbhvas=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15/go.mod h1:Tkrthp/0sNBShQQsamR7j/zY4p19tVTAs+nnqhH6R3c=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 h1:oKnAXxSF2FUvfgw8uzU/v9OTYorJJZ8eBmWhr9TWVVQ=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8/go.mod h1:rDVhIMAX9N2r8nWxDUlbubvvaFMnfsm+3jAV7q+rpM4=
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 h1:760bUnTX/+d693FT6T6Oa7PZHfEQT9XMFZeM5IQIB0A=
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12/go.mod h1:MO4qguFjs3wPGcCSpQ7kOFTwRvb+eu+fn+1vKleGHUk=
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9 h1:yOfILxyjmtr2ubRkRJldlHDFBhf5vw4CzhbwWIBmimQ=
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9/go.mod h1:O1IvkYxr+39hRf960Us6j0x1P8pDqhTX+oXM5kQNl/Y=
github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0=
github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@ -505,8 +458,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=
@ -659,7 +610,6 @@ github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1Yu
github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
@ -772,7 +722,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
@ -848,7 +797,6 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
@ -856,7 +804,6 @@ github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+z
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
@ -873,8 +820,6 @@ github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca h1:G
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20210325043845-84a0811633ca/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
@ -892,7 +837,6 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
@ -914,8 +858,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
@ -1094,7 +1036,6 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -1208,7 +1149,6 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@ -1467,12 +1407,10 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

@ -35,14 +35,10 @@ func NewGinRouter() *gin.Engine {
userRouterGroup := r.Group("/user")
{
u := NewUser(zk)
userRouterGroup.POST("/user_register", u.UserRegister)
userRouterGroup.POST("/update_user_info", u.UpdateUserInfo) //1
userRouterGroup.POST("/set_global_msg_recv_opt", u.SetGlobalRecvMessageOpt)
userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1
userRouterGroup.POST("/get_self_user_info", u.GetSelfUserInfo) //1
userRouterGroup.POST("/get_users_online_status", u.GetUsersOnlineStatus) //1
userRouterGroup.POST("/get_users_info_from_cache", u.GetUsersInfoFromCache)
userRouterGroup.POST("/get_user_friend_from_cache", u.GetFriendIDListFromCache)
userRouterGroup.POST("/get_black_list_from_cache", u.GetBlackIDListFromCache)
userRouterGroup.POST("/get_users_info", u.GetUsersPublicInfo) //1
//userRouterGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) // todo
//userRouterGroup.POST("/account_check", manage.AccountCheck) // todo
userRouterGroup.POST("/get_users", u.GetUsers)
@ -100,21 +96,16 @@ func NewGinRouter() *gin.Engine {
authRouterGroup := r.Group("/auth")
{
a := NewAuth(zk)
authRouterGroup.POST("/user_register", a.UserRegister) //1
u := NewUser(zk)
authRouterGroup.POST("/user_register", u.UserRegister) //1
authRouterGroup.POST("/user_token", a.UserToken) //1
authRouterGroup.POST("/parse_token", a.ParseToken) //1
authRouterGroup.POST("/force_logout", a.ForceLogout) //1
}
/*
*/
////Third service
thirdGroup := r.Group("/third")
{
t := NewThird(zk)
thirdGroup.POST("/get_rtc_invitation_info", t.GetSignalInvitationInfo)
thirdGroup.POST("/get_rtc_invitation_start_app", t.GetSignalInvitationInfoStartApp)
thirdGroup.POST("/fcm_update_token", t.FcmUpdateToken)

@ -27,6 +27,10 @@ func (o *User) client() (user.UserClient, error) {
return user.NewUserClient(conn), nil
}
func (o *User) UserRegister(c *gin.Context) {
a2r.Call(user.UserClient.UserRegister, o.client, c)
}
func (o *User) UpdateUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.UpdateUserInfo, o.client, c)
}
@ -39,26 +43,6 @@ func (o *User) GetUsersPublicInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetDesignateUsers, o.client, c)
}
func (o *User) GetSelfUserInfo(c *gin.Context) {
a2r.Call(user.UserClient.GetSelfUserInfo, o.client, c)
}
func (o *User) GetUsersOnlineStatus(c *gin.Context) {
a2r.Call(user.UserClient.GetUsersOnlineStatus, o.client, c)
}
func (o *User) GetUsersInfoFromCache(c *gin.Context) {
a2r.Call(user.UserClient.GetUsersInfoFromCache, o.client, c)
}
func (o *User) GetFriendIDListFromCache(c *gin.Context) {
a2r.Call(user.UserClient.GetFriendIDListFromCache, o.client, c)
}
func (o *User) GetBlackIDListFromCache(c *gin.Context) {
a2r.Call(user.UserClient.GetBlackIDListFromCache, o.client, c)
}
//func (u *User) GetAllUsersUid(c *gin.Context) {
// a2r.Call(user.UserClient.GetAllUsersUid, u.client, c)
//}

@ -1,52 +0,0 @@
package common
import (
"OpenIM/internal/api2rpc"
"OpenIM/pkg/proto/group"
"fmt"
"github.com/gin-gonic/gin"
"reflect"
"testing"
"time"
)
type AReq struct {
}
type AResp struct {
}
func KickGroupMember(c *gin.Context) {
// 默认 全部自动
api2rpc.NewRpc(api2rpc.NewGin[AReq, AResp](c), group.NewGroupClient, group.GroupClient.KickGroupMember).Call()
//// 可以自定义编辑请求和响应
//a := NewRpc(NewGin[apistruct.KickGroupMemberReq, apistruct.KickGroupMemberResp](c), group.NewGroupClient, group.GroupClient.KickGroupMember)
//a.Before(func(apiReq *apistruct.KickGroupMemberReq, rpcReq *group.KickGroupMemberReq, bind func() error) error {
// return bind()
//}).After(func(rpcResp *group.KickGroupMemberResp, apiResp *apistruct.KickGroupMemberResp, bind func() error) error {
// return bind()
//}).Name("group").Call()
}
//func getInterfaceName(handler PackerHandler) string {
// funcInfo := runtime.FuncForPC(reflect.ValueOf(handler).Pointer())
// name := funcInfo.Name()
// names := strings.Split(name, "/")
// if len(names) == 0 {
// return ""
// }
//
// return names[len(names)-1]
//}
func TestName(t *testing.T) {
n := 100000000
start := time.Now().UnixNano()
for i := 0; i < n; i++ {
var val group.GroupClient
reflect.TypeOf(&val).Elem().String()
}
end := time.Now().UnixNano()
fmt.Println(time.Duration(end-start) / time.Duration(n))
}

@ -3,8 +3,8 @@ package check
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
discoveryRegistry "OpenIM/pkg/discoveryregistry"
sdkws "OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/proto/user"
"OpenIM/pkg/utils"
"context"
@ -12,18 +12,18 @@ import (
"strings"
)
func NewUserCheck(zk discoveryRegistry.SvcDiscoveryRegistry) *UserCheck {
func NewUserCheck(client discoveryregistry.SvcDiscoveryRegistry) *UserCheck {
return &UserCheck{
zk: zk,
client: client,
}
}
type UserCheck struct {
zk discoveryRegistry.SvcDiscoveryRegistry
client discoveryregistry.SvcDiscoveryRegistry
}
func (u *UserCheck) getConn() (*grpc.ClientConn, error) {
return u.zk.GetConn(config.Config.RpcRegisterName.OpenImUserName)
return u.client.GetConn(config.Config.RpcRegisterName.OpenImUserName)
}
func (u *UserCheck) GetUsersInfos(ctx context.Context, userIDs []string, complete bool) ([]*sdkws.UserInfo, error) {
@ -107,5 +107,8 @@ func (u *UserCheck) GetUserGlobalMsgRecvOpt(ctx context.Context, userID string)
resp, err := user.NewUserClient(cc).GetGlobalRecvMessageOpt(ctx, &user.GetGlobalRecvMessageOptReq{
UserID: userID,
})
if err != nil {
return 0, err
}
return resp.GlobalRecvMsgOpt, err
}

@ -14,7 +14,7 @@ func (c *Check) ExtendMessageUpdatedNotification(ctx context.Context, sendID str
req *msg.SetMessageReactionExtensionsReq, resp *msg.SetMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
var m apistruct.ReactionMessageModifierNotification
m.SourceID = req.SourceID
m.OpUserID = req.OpUserID
m.OpUserID = tracelog.GetOpUserID(ctx)
m.SessionType = req.SessionType
keyMap := make(map[string]*sdkws.KeyValue)
for _, valueResp := range resp.Result {
@ -33,7 +33,7 @@ func (c *Check) ExtendMessageUpdatedNotification(ctx context.Context, sendID str
c.messageReactionSender(ctx, sendID, sourceID, sessionType, constant.ReactionMessageModifier, utils.StructToJsonString(m), isHistory, isReactionFromCache)
}
func (c *Check) ExtendMessageDeleteNotification(ctx context.Context, sendID string, sourceID string, sessionType int32,
req *msg.DeleteMessageListReactionExtensionsReq, resp *msg.DeleteMessageListReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
req *msg.DeleteMessagesReactionExtensionsReq, resp *msg.DeleteMessagesReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
var m apistruct.ReactionMessageDeleteNotification
m.SourceID = req.SourceID
m.OpUserID = req.OpUserID

@ -1,46 +0,0 @@
package rpcserver
import (
"OpenIM/internal/common/network"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/log"
discoveryRegistry "OpenIM/pkg/discoveryregistry"
"github.com/OpenIMSDK/openKeeper"
"net"
"strconv"
)
type RpcServer struct {
Port int
RegisterName string
RegisterCenter discoveryRegistry.SvcDiscoveryRegistry
}
func NewRpcServer(registerIPInConfig string, port int, registerName string, zkServers []string, zkRoot string) (*RpcServer, error) {
log.NewPrivateLog(constant.LogFileName)
s := &RpcServer{
Port: port,
RegisterName: registerName,
}
zkClient, err := openKeeper.NewClient(zkServers, zkRoot, 10, "", "")
if err != nil {
return nil, err
}
registerIP, err := network.GetRpcRegisterIP(registerIPInConfig)
if err != nil {
return nil, err
}
s.RegisterCenter = zkClient
err = s.RegisterCenter.Register(s.RegisterName, registerIP, s.Port)
if err != nil {
return nil, err
}
return s, nil
}
func GetTcpListen(listenIPInConfig string, port int) (net.Listener, string, error) {
address := network.GetListenIP(listenIPInConfig) + ":" + strconv.Itoa(port)
listener, err := net.Listen("tcp", address)
return listener, address, err
}

@ -4,10 +4,10 @@ import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/log"
prome "OpenIM/pkg/common/prome"
"OpenIM/pkg/common/prome"
"OpenIM/pkg/common/tokenverify"
"OpenIM/pkg/proto/msggateway"
sdkws "OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/utils"
"bytes"
"context"
@ -44,12 +44,11 @@ func initPrometheus() {
func (r *RPCServer) onInit(rpcPort int) {
r.rpcPort = rpcPort
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImRelayName
r.etcdSchema = config.Config.Etcd.EtcdSchema
r.etcdAddr = config.Config.Etcd.EtcdAddr
r.rpcRegisterName = config.Config.RpcRegisterName.OpenImMessageGatewayName
r.platformList = genPlatformArray()
r.pushTerminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID}
}
func (r *RPCServer) run() {
listenIP := ""
if config.Config.ListenIP == "" {
@ -76,7 +75,7 @@ func (r *RPCServer) run() {
}
srv := grpc.NewServer(grpcOpts...)
defer srv.GracefulStop()
msggateway.RegisterRelayServer(srv, r)
msggateway.RegisterMsgGatewayServer(srv, r)
rpcRegisterIP := config.Config.RpcRegisterIP
if config.Config.RpcRegisterIP == "" {
@ -97,7 +96,7 @@ func (r *RPCServer) run() {
return
}
}
func (r *RPCServer) OnlinePushMsg(_ context.Context, in *msggateway.OnlinePushMsgReq) (*msggateway.OnlinePushMsgResp, error) {
func (r *RPCServer) OnlinePushMsg(ctx context.Context, in *msggateway.OnlinePushMsgReq) (*msggateway.OnlinePushMsgResp, error) {
log.NewInfo(in.OperationID, "PushMsgToUser is arriving", in.String())
var resp []*msggateway.SingleMsgToUserPlatform
msgBytes, _ := proto.Marshal(in.MsgData)

@ -70,8 +70,8 @@ func (ws *WServer) run() {
func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
operationID := ""
if len(query["operationID"]) != 0 {
operationID = query["operationID"][0]
if len(query[constant.OperationID]) != 0 {
operationID = query[constant.OperationID][0]
} else {
operationID = utils.OperationIDGenerator()
}

@ -2,27 +2,54 @@ package msgtransfer
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/db/relation"
relationTb "OpenIM/pkg/common/db/table/relation"
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/common/prome"
"fmt"
)
type MsgTransfer struct {
persistentCH PersistentConsumerHandler // 聊天记录持久化到mysql的消费者 订阅的topic: ws2ms_chat
historyCH OnlineHistoryRedisConsumerHandler // 这个消费者聚合消息, 订阅的topicws2ms_chat, 修改通知发往msg_to_modify topic, 消息存入redis后Incr Redis, 再发消息到ms2pschat topic推送 发消息到msg_to_mongo topic持久化
historyMongoCH OnlineHistoryMongoConsumerHandler // mongoDB批量插入, 成功后删除redis中消息以及处理删除通知消息删除的 订阅的topic: msg_to_mongo
modifyCH ModifyMsgConsumerHandler // 负责消费修改消息通知的consumer, 订阅的topic: msg_to_modify
persistentCH *PersistentConsumerHandler // 聊天记录持久化到mysql的消费者 订阅的topic: ws2ms_chat
historyCH *OnlineHistoryRedisConsumerHandler // 这个消费者聚合消息, 订阅的topicws2ms_chat, 修改通知发往msg_to_modify topic, 消息存入redis后Incr Redis, 再发消息到ms2pschat topic推送 发消息到msg_to_mongo topic持久化
historyMongoCH *OnlineHistoryMongoConsumerHandler // mongoDB批量插入, 成功后删除redis中消息以及处理删除通知消息删除的 订阅的topic: msg_to_mongo
modifyCH *ModifyMsgConsumerHandler // 负责消费修改消息通知的consumer, 订阅的topic: msg_to_modify
}
func NewMsgTransfer() *MsgTransfer {
msgTransfer := &MsgTransfer{}
msgTransfer.persistentCH.Init()
msgTransfer.historyCH.Init()
msgTransfer.historyMongoCH.Init()
msgTransfer.modifyCH.Init()
if config.Config.Prometheus.Enable {
msgTransfer.initPrometheus()
func StartTransfer(prometheusPort int) error {
db, err := relation.NewGormDB()
if err != nil {
return err
}
return msgTransfer
if err := db.AutoMigrate(&relationTb.ChatLogModel{}); err != nil {
return err
}
rdb, err := cache.NewRedis()
if err != nil {
return err
}
mongo, err := unrelation.NewMongo()
if err != nil {
return err
}
cacheModel := cache.NewCacheModel(rdb)
msgDocModel := unrelation.NewMsgMongoDriver(mongo.GetDatabase())
extendMsgModel := unrelation.NewExtendMsgSetMongoDriver(mongo.GetDatabase())
chatLogDatabase := controller.NewChatLogDatabase(relation.NewChatLogGorm(db))
extendMsgDatabase := controller.NewExtendMsgDatabase(extendMsgModel)
msgDatabase := controller.NewMsgDatabase(msgDocModel, cacheModel)
msgTransfer := NewMsgTransfer(chatLogDatabase, extendMsgDatabase, msgDatabase)
msgTransfer.initPrometheus()
return msgTransfer.Start(prometheusPort)
}
func NewMsgTransfer(chatLogDatabase controller.ChatLogDatabase, extendMsgDatabase controller.ExtendMsgDatabase, msgDatabase controller.MsgDatabase) *MsgTransfer {
return &MsgTransfer{persistentCH: NewPersistentConsumerHandler(chatLogDatabase), historyCH: NewOnlineHistoryRedisConsumerHandler(msgDatabase),
historyMongoCH: NewOnlineHistoryMongoConsumerHandler(msgDatabase), modifyCH: NewModifyMsgConsumerHandler(extendMsgDatabase)}
}
func (m *MsgTransfer) initPrometheus() {
@ -36,19 +63,18 @@ func (m *MsgTransfer) initPrometheus() {
prome.NewMsgInsertMongoFailedCounter()
}
func (m *MsgTransfer) Run(promePort int) {
func (m *MsgTransfer) Start(prometheusPort int) error {
if config.Config.ChatPersistenceMysql {
go m.persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(&m.persistentCH)
go m.persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(m.persistentCH)
} else {
fmt.Println("msg transfer not start mysql consumer")
}
go m.historyCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyCH)
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(&m.historyMongoCH)
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(&m.modifyCH)
go func() {
err := prome.StartPrometheusSrv(promePort)
if err != nil {
panic(err)
}
}()
go m.historyCH.historyConsumerGroup.RegisterHandleAndConsumer(m.historyCH)
go m.historyMongoCH.historyConsumerGroup.RegisterHandleAndConsumer(m.historyMongoCH)
go m.modifyCH.modifyMsgConsumerGroup.RegisterHandleAndConsumer(m.modifyCH)
err := prome.StartPrometheusSrv(prometheusPort)
if err != nil {
return err
}
return nil
}

@ -25,10 +25,13 @@ type ModifyMsgConsumerHandler struct {
extendMsgDatabase controller.ExtendMsgDatabase
}
func (mmc *ModifyMsgConsumerHandler) Init() {
mmc.modifyMsgConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToModify.Topic},
config.Config.Kafka.MsgToModify.Addr, config.Config.Kafka.ConsumerGroupID.MsgToModify)
func NewModifyMsgConsumerHandler(database controller.ExtendMsgDatabase) *ModifyMsgConsumerHandler {
return &ModifyMsgConsumerHandler{
modifyMsgConsumerGroup: kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToModify.Topic},
config.Config.Kafka.MsgToModify.Addr, config.Config.Kafka.ConsumerGroupID.MsgToModify),
extendMsgDatabase: database,
}
}
func (ModifyMsgConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
@ -38,7 +41,8 @@ func (mmc *ModifyMsgConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSessi
for msg := range claim.Messages() {
log.NewDebug("", "kafka get info to mysql", "ModifyMsgConsumerHandler", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
if len(msg.Value) != 0 {
mmc.ModifyMsg(msg, string(msg.Key), sess)
ctx := mmc.modifyMsgConsumerGroup.GetContextFromMsg(msg)
mmc.ModifyMsg(ctx, msg, string(msg.Key), sess)
} else {
log.Error("", "msg get from kafka but is nil", msg.Key)
}
@ -47,29 +51,30 @@ func (mmc *ModifyMsgConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSessi
return nil
}
func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
func (mmc *ModifyMsgConsumerHandler) ModifyMsg(ctx context.Context, cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
log.NewInfo("msg come here ModifyMsg!!!", "", "msg", string(cMsg.Value), msgKey)
msgFromMQ := pbMsg.MsgDataToModifyByMQ{}
operationID := tracelog.GetOperationID(ctx)
err := proto.Unmarshal(cMsg.Value, &msgFromMQ)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "msg_transfer Unmarshal msg err", "msg", string(cMsg.Value), "err", err.Error())
return
}
log.Debug(msgFromMQ.TriggerID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
for _, msgDataToMQ := range msgFromMQ.MessageList {
for _, msgDataToMQ := range msgFromMQ.Messages {
isReactionFromCache := utils.GetSwitchFromOptions(msgDataToMQ.MsgData.Options, constant.IsReactionFromCache)
if !isReactionFromCache {
continue
}
ctx := context.Background()
tracelog.SetOperationID(ctx, msgDataToMQ.OperationID)
tracelog.SetOperationID(ctx, operationID)
if msgDataToMQ.MsgData.ContentType == constant.ReactionMessageModifier {
notification := &apistruct.ReactionMessageModifierNotification{}
if err := json.Unmarshal(msgDataToMQ.MsgData.Content, notification); err != nil {
continue
}
if notification.IsExternalExtensions {
log.NewInfo(msgDataToMQ.OperationID, "msg:", notification, "this is external extensions")
log.NewInfo(operationID, "msg:", notification, "this is external extensions")
continue
}
if !notification.IsReact {
@ -89,7 +94,7 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg
}
if err := mmc.extendMsgDatabase.InsertExtendMsg(ctx, notification.SourceID, notification.SessionType, &extendMsg); err != nil {
log.NewError(msgDataToMQ.OperationID, "MsgFirstModify InsertExtendMsg failed", notification.SourceID, notification.SessionType, extendMsg, err.Error())
log.NewError(operationID, "MsgFirstModify InsertExtendMsg failed", notification.SourceID, notification.SessionType, extendMsg, err.Error())
continue
}
} else {
@ -103,7 +108,7 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg
}
// is already modify
if err := mmc.extendMsgDatabase.InsertOrUpdateReactionExtendMsgSet(ctx, notification.SourceID, notification.SessionType, notification.ClientMsgID, notification.MsgFirstModifyTime, reactionExtensionList); err != nil {
log.NewError(msgDataToMQ.OperationID, "InsertOrUpdateReactionExtendMsgSet failed")
log.NewError(operationID, "InsertOrUpdateReactionExtendMsgSet failed")
}
}
} else if msgDataToMQ.MsgData.ContentType == constant.ReactionMessageDeleter {
@ -112,7 +117,7 @@ func (mmc *ModifyMsgConsumerHandler) ModifyMsg(cMsg *sarama.ConsumerMessage, msg
continue
}
if err := mmc.extendMsgDatabase.DeleteReactionExtendMsgSet(ctx, notification.SourceID, notification.SessionType, notification.ClientMsgID, notification.MsgFirstModifyTime, notification.SuccessReactionExtensionList); err != nil {
log.NewError(msgDataToMQ.OperationID, "InsertOrUpdateReactionExtendMsgSet failed")
log.NewError(operationID, "InsertOrUpdateReactionExtendMsgSet failed")
}
}
}

@ -3,13 +3,11 @@ package msgtransfer
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/kafka"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
pbMsg "OpenIM/pkg/proto/msg"
pbPush "OpenIM/pkg/proto/push"
"OpenIM/pkg/statistics"
"OpenIM/pkg/utils"
"context"
@ -57,10 +55,11 @@ type OnlineHistoryRedisConsumerHandler struct {
producerToMongo *kafka.Producer
msgDatabase controller.MsgDatabase
cache cache.Cache
}
func (och *OnlineHistoryRedisConsumerHandler) Init() {
func NewOnlineHistoryRedisConsumerHandler(database controller.MsgDatabase) *OnlineHistoryRedisConsumerHandler {
var och OnlineHistoryRedisConsumerHandler
och.msgDatabase = database
och.msgDistributionCh = make(chan Cmd2Value) //no buffer channel
go och.MessagesDistributionHandle()
for i := 0; i < ChannelNum; i++ {
@ -73,8 +72,8 @@ func (och *OnlineHistoryRedisConsumerHandler) Init() {
och.historyConsumerGroup = kafka.NewMConsumerGroup(&kafka.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToRedis)
statistics.NewStatistics(&och.singleMsgSuccessCount, config.Config.ModuleName.MsgTransferName, fmt.Sprintf("%d second singleMsgCount insert to mongo", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
return &och
}
func (och *OnlineHistoryRedisConsumerHandler) Run(channelID int) {
@ -242,17 +241,17 @@ func (och *OnlineHistoryRedisConsumerHandler) ConsumeClaim(sess sarama.ConsumerG
}
func (och *OnlineHistoryRedisConsumerHandler) sendMessageToPushMQ(ctx context.Context, message *pbMsg.MsgDataToMQ, pushToUserID string) {
mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID}
pid, offset, err := och.producerToPush.SendMessage(ctx, &mqPushMsg, mqPushMsg.PushToUserID)
mqPushMsg := pbMsg.PushMsgDataToMQ{MsgData: message.MsgData, SourceID: pushToUserID}
pid, offset, err := och.producerToPush.SendMessage(ctx, &mqPushMsg, mqPushMsg.SourceID)
if err != nil {
log.Error(mqPushMsg.OperationID, "kafka send failed", "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error())
log.Error(tracelog.GetOperationID(ctx), "kafka send failed", "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error())
}
return
}
func (och *OnlineHistoryRedisConsumerHandler) sendMessageToModifyMQ(ctx context.Context, aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ) {
if len(messages) > 0 {
pid, offset, err := och.producerToModify.SendMessage(ctx, &pbMsg.MsgDataToModifyByMQ{AggregationID: aggregationID, MessageList: messages, TriggerID: triggerID}, aggregationID)
pid, offset, err := och.producerToModify.SendMessage(ctx, &pbMsg.MsgDataToModifyByMQ{AggregationID: aggregationID, Messages: messages, TriggerID: triggerID}, aggregationID)
if err != nil {
log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
}
@ -261,7 +260,7 @@ func (och *OnlineHistoryRedisConsumerHandler) sendMessageToModifyMQ(ctx context.
func (och *OnlineHistoryRedisConsumerHandler) SendMessageToMongoCH(ctx context.Context, aggregationID string, triggerID string, messages []*pbMsg.MsgDataToMQ, lastSeq int64) {
if len(messages) > 0 {
pid, offset, err := och.producerToMongo.SendMessage(ctx, &pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, AggregationID: aggregationID, MessageList: messages, TriggerID: triggerID}, aggregationID)
pid, offset, err := och.producerToMongo.SendMessage(ctx, &pbMsg.MsgDataToMongoByMQ{LastSeq: lastSeq, AggregationID: aggregationID, Messages: messages, TriggerID: triggerID}, aggregationID)
if err != nil {
log.Error(triggerID, "kafka send failed", "send data", len(messages), "pid", pid, "offset", offset, "err", err.Error(), "key", aggregationID)
}

@ -3,7 +3,6 @@ package msgtransfer
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
kfk "OpenIM/pkg/common/kafka"
"OpenIM/pkg/common/log"
@ -19,66 +18,68 @@ import (
type OnlineHistoryMongoConsumerHandler struct {
historyConsumerGroup *kfk.MConsumerGroup
msgDatabase controller.MsgDatabase
cache cache.Cache
}
func (mc *OnlineHistoryMongoConsumerHandler) Init() {
mc.historyConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToMongo.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo)
func NewOnlineHistoryMongoConsumerHandler(database controller.MsgDatabase) *OnlineHistoryMongoConsumerHandler {
mc := &OnlineHistoryMongoConsumerHandler{
historyConsumerGroup: kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.MsgToMongo.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMongo),
msgDatabase: database,
}
return mc
}
func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(ctx context.Context, cMsg *sarama.ConsumerMessage, msgKey string, session sarama.ConsumerGroupSession) {
msg := cMsg.Value
msgFromMQ := pbMsg.MsgDataToMongoByMQ{}
operationID := tracelog.GetOperationID(ctx)
err := proto.Unmarshal(msg, &msgFromMQ)
if err != nil {
log.Error("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
return
}
log.Info(msgFromMQ.TriggerID, "BatchInsertChat2DB userID: ", msgFromMQ.AggregationID, "msgFromMQ.LastSeq: ", msgFromMQ.LastSeq)
ctx := context.Background()
tracelog.SetOperationID(ctx, msgFromMQ.TriggerID)
log.Info(operationID, "BatchInsertChat2DB userID: ", msgFromMQ.AggregationID, "msgFromMQ.LastSeq: ", msgFromMQ.LastSeq)
//err = db.DB.BatchInsertChat2DB(msgFromMQ.AggregationID, msgFromMQ.MessageList, msgFromMQ.TriggerID, msgFromMQ.LastSeq)
err = mc.msgDatabase.BatchInsertChat2DB(ctx, msgFromMQ.AggregationID, msgFromMQ.MessageList, msgFromMQ.LastSeq)
err = mc.msgDatabase.BatchInsertChat2DB(ctx, msgFromMQ.AggregationID, msgFromMQ.Messages, msgFromMQ.LastSeq)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "single data insert to mongo err", err.Error(), msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.Messages, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
}
//err = db.DB.DeleteMessageFromCache(msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.GetTriggerID())
err = mc.msgDatabase.DeleteMessageFromCache(ctx, msgFromMQ.AggregationID, msgFromMQ.MessageList)
err = mc.msgDatabase.DeleteMessageFromCache(ctx, msgFromMQ.AggregationID, msgFromMQ.Messages)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "remove cache msg from redis err", err.Error(), msgFromMQ.MessageList, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
log.NewError(operationID, "remove cache msg from redis err", err.Error(), msgFromMQ.Messages, msgFromMQ.AggregationID, msgFromMQ.TriggerID)
}
for _, v := range msgFromMQ.MessageList {
for _, v := range msgFromMQ.Messages {
if v.MsgData.ContentType == constant.DeleteMessageNotification {
tips := sdkws.TipsComm{}
DeleteMessageTips := sdkws.DeleteMessageTips{}
err := proto.Unmarshal(v.MsgData.Content, &tips)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "tips unmarshal err:", err.Error(), v.String())
log.NewError(operationID, "tips unmarshal err:", err.Error(), v.String())
continue
}
err = proto.Unmarshal(tips.Detail, &DeleteMessageTips)
if err != nil {
log.NewError(msgFromMQ.TriggerID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
log.NewError(operationID, "deleteMessageTips unmarshal err:", err.Error(), v.String())
continue
}
if totalUnExistSeqs, err := mc.msgDatabase.DelMsgBySeqs(ctx, DeleteMessageTips.UserID, DeleteMessageTips.Seqs); err != nil {
log.NewError(v.OperationID, utils.GetSelfFuncName(), "DelMsgBySeqs args: ", DeleteMessageTips.UserID, DeleteMessageTips.Seqs, "error:", err.Error(), "totalUnExistSeqs: ", totalUnExistSeqs)
log.NewError(operationID, utils.GetSelfFuncName(), "DelMsgBySeqs args: ", DeleteMessageTips.UserID, DeleteMessageTips.Seqs, "error:", err.Error(), "totalUnExistSeqs: ", totalUnExistSeqs)
}
}
}
}
func (OnlineHistoryMongoConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
func (OnlineHistoryMongoConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
func (mc *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
func (mc *OnlineHistoryMongoConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { // a instance in the consumer group
log.NewDebug("", "online new session msg come", claim.HighWaterMarkOffset(), claim.Topic(), claim.Partition())
for msg := range claim.Messages() {
log.NewDebug("", "kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
if len(msg.Value) != 0 {
mc.handleChatWs2Mongo(msg, string(msg.Key), sess)
ctx := mc.historyConsumerGroup.GetContextFromMsg(msg)
mc.handleChatWs2Mongo(ctx, msg, string(msg.Key), sess)
} else {
log.Error("", "mongo msg get from kafka but is nil", msg.Key)
}

@ -12,8 +12,10 @@ import (
"OpenIM/pkg/common/db/controller"
kfk "OpenIM/pkg/common/kafka"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
pbMsg "OpenIM/pkg/proto/msg"
"OpenIM/pkg/utils"
"context"
"github.com/Shopify/sarama"
"github.com/golang/protobuf/proto"
@ -21,26 +23,30 @@ import (
type PersistentConsumerHandler struct {
persistentConsumerGroup *kfk.MConsumerGroup
chatLogInterface controller.ChatLogDatabase
chatLogDatabase controller.ChatLogDatabase
}
func (pc *PersistentConsumerHandler) Init() {
pc.persistentConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql)
func NewPersistentConsumerHandler(database controller.ChatLogDatabase) *PersistentConsumerHandler {
return &PersistentConsumerHandler{
persistentConsumerGroup: kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ws2mschat.Topic},
config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql),
chatLogDatabase: database,
}
}
func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
func (pc *PersistentConsumerHandler) handleChatWs2Mysql(ctx context.Context, cMsg *sarama.ConsumerMessage, msgKey string, _ sarama.ConsumerGroupSession) {
msg := cMsg.Value
operationID := tracelog.GetOperationID(ctx)
log.NewInfo("msg come here mysql!!!", "", "msg", string(msg), msgKey)
var tag bool
msgFromMQ := pbMsg.MsgDataToMQ{}
err := proto.Unmarshal(msg, &msgFromMQ)
if err != nil {
log.NewError(msgFromMQ.OperationID, "msg_transfer Unmarshal msg err", "msg", string(msg), "err", err.Error())
log.NewError(operationID, "msg_transfer Unmarshal msg err", "msg", string(msg), "err", err.Error())
return
}
log.Debug(msgFromMQ.OperationID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
log.Debug(operationID, "proto.Unmarshal MsgDataToMQ", msgFromMQ.String())
//Control whether to store history messages (mysql)
isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent)
//Only process receiver data
@ -58,23 +64,22 @@ func (pc *PersistentConsumerHandler) handleChatWs2Mysql(cMsg *sarama.ConsumerMes
tag = true
}
if tag {
log.NewInfo(msgFromMQ.OperationID, "msg_transfer msg persisting", string(msg))
log.NewInfo(operationID, "msg_transfer msg persisting", string(msg))
if err = pc.chatLogInterface.CreateChatLog(msgFromMQ); err != nil {
log.NewError(msgFromMQ.OperationID, "Message insert failed", "err", err.Error(), "msg", msgFromMQ.String())
log.NewError(operationID, "Message insert failed", "err", err.Error(), "msg", msgFromMQ.String())
return
}
}
}
}
func (PersistentConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }
func (PersistentConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil }
func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error {
func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error {
for msg := range claim.Messages() {
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value), "key", string(msg.Key))
if len(msg.Value) != 0 {
pc.handleChatWs2Mysql(msg, string(msg.Key), sess)
ctx := pc.persistentConsumerGroup.GetContextFromMsg(msg)
pc.handleChatWs2Mysql(ctx, msg, string(msg.Key), sess)
} else {
log.Error("", "msg get from kafka but is nil", msg.Key)
}

@ -95,7 +95,7 @@ func (m *minioImpl) GetObjectInfo(ctx context.Context, args *BucketFile) (*Objec
}, nil
}
func (m *minioImpl) CopyObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
func (m *minioImpl) CopyObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
destination, err := minio.NewDestinationInfo(dst.Bucket, dst.Name, nil, nil)
if err != nil {
return err
@ -103,15 +103,15 @@ func (m *minioImpl) CopyObjetInfo(ctx context.Context, src *BucketFile, dst *Buc
return m.client.CopyObject(destination, minio.NewSourceInfo(src.Bucket, src.Name, nil))
}
func (m *minioImpl) DeleteObjetInfo(ctx context.Context, info *BucketFile) error {
func (m *minioImpl) DeleteObjectInfo(ctx context.Context, info *BucketFile) error {
return m.client.RemoveObject(info.Bucket, info.Name)
}
func (m *minioImpl) MoveObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
if err := m.CopyObjetInfo(ctx, src, dst); err != nil {
func (m *minioImpl) MoveObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error {
if err := m.CopyObjectInfo(ctx, src, dst); err != nil {
return err
}
return m.DeleteObjetInfo(ctx, src)
return m.DeleteObjectInfo(ctx, src)
}
func (m *minioImpl) MergeObjectInfo(ctx context.Context, src []BucketFile, dst *BucketFile) error {
@ -119,7 +119,7 @@ func (m *minioImpl) MergeObjectInfo(ctx context.Context, src []BucketFile, dst *
case 0:
return errors.New("src empty")
case 1:
return m.CopyObjetInfo(ctx, &src[0], dst)
return m.CopyObjectInfo(ctx, &src[0], dst)
}
destination, err := minio.NewDestinationInfo(dst.Bucket, dst.Name, nil, nil)
if err != nil {

@ -11,9 +11,9 @@ type Interface interface {
ClearBucket() string
ApplyPut(ctx context.Context, args *ApplyPutArgs) (*PutRes, error)
GetObjectInfo(ctx context.Context, args *BucketFile) (*ObjectInfo, error)
CopyObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
DeleteObjetInfo(ctx context.Context, info *BucketFile) error
MoveObjetInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
CopyObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
DeleteObjectInfo(ctx context.Context, info *BucketFile) error
MoveObjectInfo(ctx context.Context, src *BucketFile, dst *BucketFile) error
MergeObjectInfo(ctx context.Context, src []BucketFile, dst *BucketFile) error
IsNotFound(err error) bool
}

@ -107,143 +107,3 @@ func callbackBeforeSuperGroupOnlinePush(ctx context.Context, groupID string, msg
}
return nil
}
//func callbackOfflinePush(operationID string, userIDList []string, msg *common.MsgData, offlinePushUserIDList *[]string) cbApi.CommonCallbackResp {
// callbackResp := cbapi.CommonCallbackResp{OperationID: operationID}
// if !config.Config.Callback.CallbackOfflinePush.Enable {
// return callbackResp
// }
// req := cbApi.CallbackBeforePushReq{
// UserStatusBatchCallbackReq: cbApi.UserStatusBatchCallbackReq{
// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{
// CallbackCommand: constant.CallbackOfflinePushCommand,
// OperationID: operationID,
// PlatformID: msg.SenderPlatformID,
// Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
// },
// UserIDList: userIDList,
// },
// OfflinePushInfo: msg.OfflinePushInfo,
// ClientMsgID: msg.ClientMsgID,
// SendID: msg.SendID,
// GroupID: msg.GroupID,
// ContentType: msg.ContentType,
// SessionType: msg.SessionType,
// AtUserIDList: msg.AtUserIDList,
// Content: callback.GetContent(msg),
// }
// resp := &cbApi.CallbackBeforePushResp{CommonCallbackResp: &callbackResp}
// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackOfflinePushCommand, req, resp, config.Config.Callback.CallbackOfflinePush.CallbackTimeOut); err != nil {
// callbackResp.ErrCode = http2.StatusInternalServerError
// callbackResp.ErrMsg = err.Error()
// if !*config.Config.Callback.CallbackOfflinePush.CallbackFailedContinue {
// callbackResp.ActionCode = constant.ActionForbidden
// return callbackResp
// } else {
// callbackResp.ActionCode = constant.ActionAllow
// return callbackResp
// }
// }
// if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
// if len(resp.UserIDList) != 0 {
// *offlinePushUserIDList = resp.UserIDList
// }
// if resp.OfflinePushInfo != nil {
// msg.OfflinePushInfo = resp.OfflinePushInfo
// }
// }
// log.NewDebug(operationID, utils.GetSelfFuncName(), offlinePushUserIDList, resp.UserIDList)
// return callbackResp
//}
//
//func callbackOnlinePush(operationID string, userIDList []string, msg *common.MsgData) cbApi.CommonCallbackResp {
// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
// if !config.Config.Callback.CallbackOnlinePush.Enable || utils.IsContain(msg.SendID, userIDList) {
// return callbackResp
// }
// req := cbApi.CallbackBeforePushReq{
// UserStatusBatchCallbackReq: cbApi.UserStatusBatchCallbackReq{
// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{
// CallbackCommand: constant.CallbackOnlinePushCommand,
// OperationID: operationID,
// PlatformID: msg.SenderPlatformID,
// Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
// },
// UserIDList: userIDList,
// },
// //OfflinePushInfo: msg.OfflinePushInfo,
// ClientMsgID: msg.ClientMsgID,
// SendID: msg.SendID,
// GroupID: msg.GroupID,
// ContentType: msg.ContentType,
// SessionType: msg.SessionType,
// AtUserIDList: msg.AtUserIDList,
// Content: callback.GetContent(msg),
// }
// resp := &cbApi.CallbackBeforePushResp{CommonCallbackResp: &callbackResp}
// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackOnlinePushCommand, req, resp, config.Config.Callback.CallbackOnlinePush.CallbackTimeOut); err != nil {
// callbackResp.ErrCode = http2.StatusInternalServerError
// callbackResp.ErrMsg = err.Error()
// if !config.Config.Callback.CallbackOnlinePush.CallbackFailedContinue {
// callbackResp.ActionCode = constant.ActionForbidden
// return callbackResp
// } else {
// callbackResp.ActionCode = constant.ActionAllow
// return callbackResp
// }
// }
// if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
// //if resp.OfflinePushInfo != nil {
// // msg.OfflinePushInfo = resp.OfflinePushInfo
// //}
// }
// return callbackResp
//}
//
//func callbackBeforeSuperGroupOnlinePush(operationID string, groupID string, msg *common.MsgData, pushToUserList *[]string) cbApi.CommonCallbackResp {
// log.Debug(operationID, utils.GetSelfFuncName(), groupID, msg.String(), pushToUserList)
// callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
// if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.Enable {
// return callbackResp
// }
// req := cbApi.CallbackBeforeSuperGroupOnlinePushReq{
// UserStatusBaseCallback: cbApi.UserStatusBaseCallback{
// CallbackCommand: constant.CallbackSuperGroupOnlinePushCommand,
// OperationID: operationID,
// PlatformID: msg.SenderPlatformID,
// Platform: constant.PlatformIDToName(int(msg.SenderPlatformID)),
// },
// //OfflinePushInfo: msg.OfflinePushInfo,
// ClientMsgID: msg.ClientMsgID,
// SendID: msg.SendID,
// GroupID: groupID,
// ContentType: msg.ContentType,
// SessionType: msg.SessionType,
// AtUserIDList: msg.AtUserIDList,
// Content: callback.GetContent(msg),
// Seq: msg.Seq,
// }
// resp := &cbApi.CallbackBeforeSuperGroupOnlinePushResp{CommonCallbackResp: &callbackResp}
// if err := http.CallBackPostReturn(config.Config.Callback.CallbackUrl, constant.CallbackSuperGroupOnlinePushCommand, req, resp, config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.CallbackTimeOut); err != nil {
// callbackResp.ErrCode = http2.StatusInternalServerError
// callbackResp.ErrMsg = err.Error()
// if !config.Config.Callback.CallbackBeforeSuperGroupOnlinePush.CallbackFailedContinue {
// callbackResp.ActionCode = constant.ActionForbidden
// return callbackResp
// } else {
// callbackResp.ActionCode = constant.ActionAllow
// return callbackResp
// }
// }
// if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
// if len(resp.UserIDList) != 0 {
// *pushToUserList = resp.UserIDList
// }
// //if resp.OfflinePushInfo != nil {
// // msg.OfflinePushInfo = resp.OfflinePushInfo
// //}
// }
// log.NewDebug(operationID, utils.GetSelfFuncName(), pushToUserList, resp.UserIDList)
// return callbackResp
//
//}

@ -0,0 +1,36 @@
/*
** description("").
** copyright('open-im,www.open-im.io').
** author("fg,Gordon@open-im.io").
** time(2021/3/22 15:33).
*/
package push
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/prome"
"OpenIM/pkg/statistics"
"fmt"
)
type Consumer struct {
pushCh ConsumerHandler
successCount uint64
}
func NewConsumer(pusher *Pusher) *Consumer {
return &Consumer{
pushCh: *NewConsumerHandler(pusher),
}
}
func (c *Consumer) initPrometheus() {
prome.NewMsgOfflinePushSuccessCounter()
prome.NewMsgOfflinePushFailedCounter()
}
func (c *Consumer) Start() {
statistics.NewStatistics(&c.successCount, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
go c.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&c.pushCh)
}

@ -19,10 +19,10 @@ var Terminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID, constan
type Fcm struct {
fcmMsgCli *messaging.Client
cache cache.Cache
cache cache.Model
}
func NewClient(cache cache.Cache) *Fcm {
func NewClient(cache cache.Model) *Fcm {
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
if err != nil {

@ -9,7 +9,7 @@ import (
)
func Test_Push(t *testing.T) {
var redis cache.Cache
var redis cache.Model
offlinePusher := NewClient(redis)
err := offlinePusher.Push(context.Background(), []string{"userID1"}, "test", "test", &push.Opts{})
assert.Nil(t, err)

@ -38,12 +38,12 @@ const (
)
type Client struct {
cache cache.Cache
cache cache.Model
tokenExpireTime int64
taskIDTTL int64
}
func NewClient(cache cache.Cache) *Client {
func NewClient(cache cache.Model) *Client {
return &Client{cache: cache, tokenExpireTime: tokenExpireTime, taskIDTTL: taskIDTTL}
}

@ -1,63 +0,0 @@
/*
** description("").
** copyright('open-im,www.open-im.io').
** author("fg,Gordon@open-im.io").
** time(2021/3/22 15:33).
*/
package push
import (
fcm "OpenIM/internal/push/fcm"
"OpenIM/internal/push/getui"
jpush "OpenIM/internal/push/jpush"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/prome"
"OpenIM/pkg/statistics"
"fmt"
)
type Push struct {
rpcServer PushServer
pushCh ConsumerHandler
offlinePusher OfflinePusher
successCount uint64
}
func (p *Push) Init(rpcPort int) error {
rdb, err := cache.NewRedis()
if err != nil {
return err
}
var cacheInterface cache.Cache
p.rpcServer.Init(rpcPort, cacheInterface)
p.pushCh.Init()
statistics.NewStatistics(&p.successCount, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
if *config.Config.Push.Getui.Enable {
p.offlinePusher = getui.NewClient(cacheInterface)
}
if config.Config.Push.Jpns.Enable {
p.offlinePusher = jpush.NewClient()
}
if config.Config.Push.Fcm.Enable {
p.offlinePusher = fcm.NewClient(cacheInterface)
}
return nil
}
func (p *Push) initPrometheus() {
prome.NewMsgOfflinePushSuccessCounter()
prome.NewMsgOfflinePushFailedCounter()
}
func (p *Push) Run(prometheusPort int) {
go p.rpcServer.run()
go p.pushCh.pushConsumerGroup.RegisterHandleAndConsumer(&p.pushCh)
go func() {
err := prome.StartPrometheusSrv(prometheusPort)
if err != nil {
panic(err)
}
}()
}

@ -1,4 +1,4 @@
package push
package jpush
import (
"OpenIM/internal/push"

@ -0,0 +1,39 @@
package push
import (
"OpenIM/internal/push/fcm"
"OpenIM/internal/push/getui"
"OpenIM/internal/push/jpush"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/db/cache"
"context"
)
type OfflinePusher interface {
Push(ctx context.Context, userIDs []string, title, content string, opts *Opts) error
}
func NewOfflinePusher(cache cache.Model) OfflinePusher {
var offlinePusher OfflinePusher
if config.Config.Push.Getui.Enable {
offlinePusher = getui.NewClient(cache)
}
if config.Config.Push.Fcm.Enable {
offlinePusher = fcm.NewClient(cache)
}
if config.Config.Push.Jpns.Enable {
offlinePusher = jpush.NewClient()
}
return offlinePusher
}
type Opts struct {
Signal *Signal
IOSPushSound string
IOSBadgeCount bool
Ex string
}
type Signal struct {
ClientMsgID string
}

@ -22,16 +22,19 @@ import (
type ConsumerHandler struct {
pushConsumerGroup *kfk.MConsumerGroup
pusher Pusher
pusher *Pusher
}
func (c *ConsumerHandler) Init() {
c.pushConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
func NewConsumerHandler(pusher *Pusher) *ConsumerHandler {
var consumerHandler ConsumerHandler
consumerHandler.pusher = pusher
consumerHandler.pushConsumerGroup = kfk.NewMConsumerGroup(&kfk.MConsumerGroupConfig{KafkaVersion: sarama.V2_0_0_0,
OffsetsInitial: sarama.OffsetNewest, IsReturnErr: false}, []string{config.Config.Kafka.Ms2pschat.Topic}, config.Config.Kafka.Ms2pschat.Addr,
config.Config.Kafka.ConsumerGroupID.MsgToPush)
return &consumerHandler
}
func (c *ConsumerHandler) handleMs2PsChat(msg []byte) {
func (c *ConsumerHandler) handleMs2PsChat(ctx context.Context, msg []byte) {
log.NewDebug("", "msg come from kafka And push!!!", "msg", string(msg))
msgFromMQ := pbChat.PushMsgDataToMQ{}
if err := proto.Unmarshal(msg, &msgFromMQ); err != nil {
@ -40,14 +43,13 @@ func (c *ConsumerHandler) handleMs2PsChat(msg []byte) {
}
pbData := &pbPush.PushMsgReq{
MsgData: msgFromMQ.MsgData,
SourceID: msgFromMQ.PushToUserID,
SourceID: msgFromMQ.SourceID,
}
sec := msgFromMQ.MsgData.SendTime / 1000
nowSec := utils.GetCurrentTimestampBySecond()
if nowSec-sec > 10 {
return
}
ctx := context.Background()
tracelog.SetOperationID(ctx, "")
var err error
switch msgFromMQ.MsgData.SessionType {
@ -66,7 +68,8 @@ func (c *ConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error {
for msg := range claim.Messages() {
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
c.handleMs2PsChat(msg.Value)
ctx := c.pushConsumerGroup.GetContextFromMsg(msg)
c.handleMs2PsChat(ctx, msg.Value)
sess.MarkMessage(msg, "")
}
return nil

@ -1,18 +0,0 @@
package push
import "context"
type OfflinePusher interface {
Push(ctx context.Context, userIDs []string, title, content string, opts *Opts) error
}
type Opts struct {
Signal *Signal
IOSPushSound string
IOSBadgeCount bool
Ex string
}
type Signal struct {
ClientMsgID string
}

@ -1,24 +1,47 @@
package push
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/db/localcache"
"OpenIM/pkg/discoveryregistry"
pbPush "OpenIM/pkg/proto/push"
"context"
"github.com/OpenIMSDK/openKeeper"
"google.golang.org/grpc"
"sync"
)
type pushServer struct {
pusher *Pusher
}
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
rdb, err := cache.NewRedis()
if err != nil {
return err
}
cacheModel := cache.NewCacheModel(rdb)
pbPush.RegisterPushMsgServiceServer(server, &pushServer{
pusher: NewPusher(),
})
offlinePusher := NewOfflinePusher(cacheModel)
database := controller.NewPushDatabase(cacheModel)
pusher := NewPusher(client, offlinePusher, database, localcache.NewGroupLocalCache(client), localcache.NewConversationLocalCache(client))
var wg sync.WaitGroup
wg.Add(2)
go func() {
defer wg.Done()
pbPush.RegisterPushMsgServiceServer(server, &pushServer{
pusher: pusher,
})
}()
go func() {
defer wg.Done()
consumer := NewConsumer(pusher)
consumer.initPrometheus()
consumer.Start()
}()
wg.Wait()
return nil
}
func (r *pushServer) PushMsg(ctx context.Context, pbData *pbPush.PushMsgReq) (resp *pbPush.PushMsgResp, err error) {

@ -27,13 +27,13 @@ type Pusher struct {
database controller.PushDatabase
client discoveryregistry.SvcDiscoveryRegistry
offlinePusher OfflinePusher
groupLocalCache localcache.GroupLocalCache
conversationLocalCache localcache.ConversationLocalCache
groupLocalCache *localcache.GroupLocalCache
conversationLocalCache *localcache.ConversationLocalCache
successCount int
}
func NewPusher(client discoveryregistry.SvcDiscoveryRegistry, offlinePusher OfflinePusher, database controller.PushDatabase,
groupLocalCache localcache.GroupLocalCache, conversationLocalCache localcache.ConversationLocalCache) *Pusher {
groupLocalCache *localcache.GroupLocalCache, conversationLocalCache *localcache.ConversationLocalCache) *Pusher {
return &Pusher{
database: database,
client: client,
@ -162,7 +162,7 @@ func (p *Pusher) MsgToSuperGroupUser(ctx context.Context, groupID string, msg *s
return nil
}
func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData, pushToUserIDs []string) (wsResults []*msggateway.SingleMsgToUserResultList, err error) {
func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData, pushToUserIDs []string) (wsResults []*msggateway.SingleMsgToUserResults, err error) {
conns, err := p.client.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
if err != nil {
return nil, err
@ -170,7 +170,7 @@ func (p *Pusher) GetConnsAndOnlinePush(ctx context.Context, msg *sdkws.MsgData,
//Online push message
for _, v := range conns {
msgClient := msggateway.NewMsgGatewayClient(v)
reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(ctx, &msggateway.OnlineBatchPushOneMsgReq{OperationID: tracelog.GetOperationID(ctx), MsgData: msg, PushToUserIDList: pushToUserIDs})
reply, err := msgClient.SuperGroupOnlineBatchPushOneMsg(ctx, &msggateway.OnlineBatchPushOneMsgReq{MsgData: msg, PushToUserIDs: pushToUserIDs})
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), msg, len(pushToUserIDs), "err", err)
continue

@ -6,8 +6,6 @@ import (
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/db/relation"
relationTb "OpenIM/pkg/common/db/table/relation"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tokenverify"
"OpenIM/pkg/common/tracelog"
@ -20,19 +18,12 @@ import (
)
type authServer struct {
controller.AuthDatabase
authDatabase controller.AuthDatabase
userCheck *check.UserCheck
RegisterCenter discoveryRegistry.SvcDiscoveryRegistry
}
func Start(client discoveryRegistry.SvcDiscoveryRegistry, server *grpc.Server) error {
mysql, err := relation.NewGormDB()
if err != nil {
return err
}
if err := mysql.AutoMigrate(&relationTb.FriendModel{}, &relationTb.FriendRequestModel{}, &relationTb.BlackModel{}); err != nil {
return err
}
rdb, err := cache.NewRedis()
if err != nil {
return err
@ -40,7 +31,7 @@ func Start(client discoveryRegistry.SvcDiscoveryRegistry, server *grpc.Server) e
pbAuth.RegisterAuthServer(server, &authServer{
userCheck: check.NewUserCheck(client),
RegisterCenter: client,
AuthDatabase: controller.NewAuthDatabase(cache.NewCache(rdb), config.Config.TokenPolicy.AccessSecret, config.Config.TokenPolicy.AccessExpire),
authDatabase: controller.NewAuthDatabase(cache.NewCacheModel(rdb), config.Config.TokenPolicy.AccessSecret, config.Config.TokenPolicy.AccessExpire),
})
return nil
}
@ -50,7 +41,7 @@ func (s *authServer) UserToken(ctx context.Context, req *pbAuth.UserTokenReq) (*
if _, err := s.userCheck.GetUsersInfo(ctx, req.UserID); err != nil {
return nil, err
}
token, err := s.CreateToken(ctx, req.UserID, constant.PlatformIDToName(int(req.PlatformID)))
token, err := s.authDatabase.CreateToken(ctx, req.UserID, constant.PlatformIDToName(int(req.PlatformID)))
if err != nil {
return nil, err
}
@ -64,7 +55,7 @@ func (s *authServer) parseToken(ctx context.Context, tokensString string) (claim
if err != nil {
return nil, utils.Wrap(err, "")
}
m, err := s.GetTokensWithoutError(ctx, claims.UID, claims.Platform)
m, err := s.authDatabase.GetTokensWithoutError(ctx, claims.UID, claims.Platform)
if err != nil {
return nil, err
}
@ -108,13 +99,13 @@ func (s *authServer) ForceLogout(ctx context.Context, req *pbAuth.ForceLogoutReq
}
func (s *authServer) forceKickOff(ctx context.Context, userID string, platformID int32, operationID string) error {
grpcCons, err := s.RegisterCenter.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
conns, err := s.RegisterCenter.GetConns(config.Config.RpcRegisterName.OpenImMessageGatewayName)
if err != nil {
return err
}
for _, v := range grpcCons {
for _, v := range conns {
client := msggateway.NewMsgGatewayClient(v)
kickReq := &msggateway.KickUserOfflineReq{OperationID: operationID, KickUserIDList: []string{userID}, PlatformID: platformID}
kickReq := &msggateway.KickUserOfflineReq{KickUserIDList: []string{userID}, PlatformID: platformID}
log.NewInfo(operationID, "KickUserOffline ", client, kickReq.String())
_, err := client.KickUserOffline(ctx, kickReq)
return utils.Wrap(err, "")

@ -9,10 +9,10 @@ import (
"OpenIM/pkg/common/db/relation"
tableRelation "OpenIM/pkg/common/db/table/relation"
"OpenIM/pkg/common/db/tx"
"OpenIM/pkg/discoveryregistry"
pbConversation "OpenIM/pkg/proto/conversation"
"OpenIM/pkg/utils"
"context"
"github.com/OpenIMSDK/openKeeper"
"github.com/dtm-labs/rockscache"
"google.golang.org/grpc"
)
@ -23,7 +23,7 @@ type conversationServer struct {
notify *notification.Check
}
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
db, err := relation.NewGormDB()
if err != nil {
return err
@ -31,13 +31,14 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
if err := db.AutoMigrate(&tableRelation.ConversationModel{}); err != nil {
return err
}
redis, err := cache.NewRedis()
rdb, err := cache.NewRedis()
if err != nil {
return err
}
pbConversation.RegisterConversationServer(server, &conversationServer{
groupChecker: check.NewGroupChecker(client),
ConversationDatabase: controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(redis.GetClient(), rockscache.Options{
ConversationDatabase: controller.NewConversationDatabase(relation.NewConversationGorm(db), cache.NewConversationRedis(rdb, rockscache.Options{
RandomExpireAdjustment: 0.2,
DisableCacheRead: false,
DisableCacheDelete: false,
@ -176,11 +177,11 @@ func (c *conversationServer) ModifyConversationField(ctx context.Context, req *p
// 获取超级大群开启免打扰的用户ID
func (c *conversationServer) GetRecvMsgNotNotifyUserIDs(ctx context.Context, req *pbConversation.GetRecvMsgNotNotifyUserIDsReq) (*pbConversation.GetRecvMsgNotNotifyUserIDsResp, error) {
resp := &pbConversation.GetRecvMsgNotNotifyUserIDsResp{}
userIDs, err := c.ConversationDatabase.FindRecvMsgNotNotifyUserIDs(ctx, req.GroupID)
if err != nil {
return nil, err
}
resp := &pbConversation.GetRecvMsgNotNotifyUserIDsResp{}
resp.UserIDs = userIDs
return resp, nil
}

@ -12,13 +12,13 @@ import (
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/common/tokenverify"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/discoveryregistry"
pbConversation "OpenIM/pkg/proto/conversation"
pbGroup "OpenIM/pkg/proto/group"
"OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/utils"
"context"
"fmt"
"github.com/OpenIMSDK/openKeeper"
"github.com/dtm-labs/rockscache"
"google.golang.org/grpc"
"gorm.io/gorm"
@ -29,7 +29,7 @@ import (
"time"
)
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
db, err := relation.NewGormDB()
if err != nil {
return err
@ -46,17 +46,7 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
return err
}
pbGroup.RegisterGroupServer(server, &groupServer{
GroupDatabase: controller.NewGroupDatabase(
relation.NewGroupDB(db),
relation.NewGroupMemberDB(db),
relation.NewGroupRequest(db),
tx.NewGorm(db),
tx.NewMongo(mongo.GetClient()),
unrelation.NewSuperGroupMongoDriver(mongo.GetClient()),
cache.NewGroupCacheRedis(rdb, relation.NewGroupDB(db), relation.NewGroupMemberDB(db), relation.NewGroupRequest(db), unrelation.NewSuperGroupMongoDriver(mongo.GetClient()), rockscache.Options{
StrongConsistency: true,
}),
),
GroupDatabase: controller.InitGroupDatabase(db, rdb, mongo.GetDatabase()),
UserCheck: check.NewUserCheck(client),
ConversationChecker: check.NewConversationChecker(client),
})

@ -3,16 +3,15 @@ package msg
import (
"OpenIM/pkg/common/tokenverify"
"OpenIM/pkg/proto/msg"
"OpenIM/pkg/proto/sdkws"
"context"
)
func (m *msgServer) DelMsgList(ctx context.Context, req *sdkws.DelMsgListReq) (*sdkws.DelMsgListResp, error) {
resp := &sdkws.DelMsgListResp{}
if _, err := m.MsgDatabase.DelMsgBySeqs(ctx, req.UserID, req.SeqList); err != nil {
func (m *msgServer) DelMsgs(ctx context.Context, req *msg.DelMsgsReq) (*msg.DelMsgsResp, error) {
resp := &msg.DelMsgsResp{}
if _, err := m.MsgDatabase.DelMsgBySeqs(ctx, req.UserID, req.Seqs); err != nil {
return nil, err
}
DeleteMessageNotification(ctx, req.UserID, req.SeqList)
DeleteMessageNotification(ctx, req.UserID, req.Seqs)
return resp, nil
}
@ -21,13 +20,6 @@ func (m *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroup
if err := tokenverify.CheckAdmin(ctx); err != nil {
return nil, err
}
//maxSeq, err := m.MsgDatabase.GetGroupMaxSeq(ctx, req.GroupID)
//if err != nil {
// return nil, err
//}
//if err := m.MsgDatabase.SetGroupUserMinSeq(ctx, req.GroupID, maxSeq); err != nil {
// return nil, err
//}
if err := m.MsgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, req.GroupID, []string{req.UserID}, 0); err != nil {
return nil, err
}
@ -42,8 +34,5 @@ func (m *msgServer) ClearMsg(ctx context.Context, req *msg.ClearMsgReq) (*msg.Cl
if err := m.MsgDatabase.CleanUpUserMsg(ctx, req.UserID); err != nil {
return nil, err
}
//if err := m.MsgDatabase.DelUserAllSeq(ctx, req.UserID); err != nil {
// return nil, err
//}
return resp, nil
}

@ -27,7 +27,7 @@ func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.S
notification.ExtendMessageUpdatedNotification(req.OperationID, req.OpUserID, req.SourceID, req.SessionType, req, &resp, !req.IsReact, false)
return resp, nil
}
isExists, err := m.MsgDatabase.JudgeMessageReactionEXISTS(ctx, req.ClientMsgID, req.SessionType)
isExists, err := m.MsgDatabase.JudgeMessageReactionExist(ctx, req.ClientMsgID, req.SessionType)
if err != nil {
return nil, err
}
@ -35,7 +35,7 @@ func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.S
if !isExists {
if !req.IsReact {
resp.MsgFirstModifyTime = utils.GetCurrentTimestampByMill()
for k, v := range req.ReactionExtensionList {
for k, v := range req.ReactionExtensions {
err := m.MessageLocker.LockMessageTypeKey(ctx, req.ClientMsgID, k)
if err != nil {
return nil, err
@ -60,10 +60,10 @@ func (m *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.S
return nil, err
}
setValue := make(map[string]*sdkws.KeyValue)
for k, v := range req.ReactionExtensionList {
for k, v := range req.ReactionExtensions {
temp := new(sdkws.KeyValue)
if vv, ok := mongoValue.ReactionExtensionList[k]; ok {
if vv, ok := mongoValue.ReactionExtensions[k]; ok {
utils.CopyStructFields(temp, &vv)
if v.LatestUpdateTime != vv.LatestUpdateTime {
setKeyResultInfo(&resp, 300, "message have update", req.ClientMsgID, k, temp)
@ -158,14 +158,14 @@ func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errC
_ = db.DB.UnLockMessageTypeKey(clientMsgID, typeKey)
}
func (m *msgServer) GetMessageListReactionExtensions(ctx context.Context, req *msg.GetMessageListReactionExtensionsReq) (resp *msg.GetMessageListReactionExtensionsResp, err error) {
func (m *msgServer) GetMessagesReactionExtensions(ctx context.Context, req *msg.GetMessagesReactionExtensionsReq) (resp *msg.GetMessagesReactionExtensionsResp, err error) {
log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String())
var rResp msg.GetMessageListReactionExtensionsResp
for _, messageValue := range req.MessageReactionKeyList {
var oneMessage msg.SingleMessageExtensionResult
oneMessage.ClientMsgID = messageValue.ClientMsgID
isExists, err := db.DB.JudgeMessageReactionEXISTS(messageValue.ClientMsgID, req.SessionType)
isExists, err := db.DB.JudgeMessageReactionExist(messageValue.ClientMsgID, req.SessionType)
if err != nil {
rResp.ErrCode = 100
rResp.ErrMsg = err.Error()
@ -218,9 +218,9 @@ func (m *msgServer) AddMessageReactionExtensions(ctx context.Context, req *msg.M
return
}
func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) {
func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessagesReactionExtensionsReq) (resp *msg.DeleteMessagesReactionExtensionsResp, err error) {
log.Debug(req.OperationID, utils.GetSelfFuncName(), "m args is:", req.String())
var rResp msg.DeleteMessageListReactionExtensionsResp
var rResp msg.DeleteMessagesReactionExtensionsResp
callbackResp := notification.callbackDeleteMessageReactionExtensions(req)
if callbackResp.ActionCode != constant.ActionAllow || callbackResp.ErrCode != 0 {
rResp.ErrCode = int32(callbackResp.ErrCode)
@ -241,7 +241,7 @@ func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *ms
return &rResp, nil
}
for _, v := range callbackResp.ResultReactionExtensionList {
for _, v := range callbackResp.ResultReactionExtensions {
if v.ErrCode != 0 {
func(req *[]*sdkws.KeyValue, typeKey string) {
for i := 0; i < len(*req); i++ {
@ -253,7 +253,7 @@ func (m *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *ms
rResp.Result = append(rResp.Result, v)
}
}
isExists, err := db.DB.JudgeMessageReactionEXISTS(req.ClientMsgID, req.SessionType)
isExists, err := db.DB.JudgeMessageReactionExist(req.ClientMsgID, req.SessionType)
if err != nil {
rResp.ErrCode = 100
rResp.ErrMsg = err.Error()

@ -18,9 +18,9 @@ func CallbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMe
OperationID: tracelog.GetOperationID(ctx),
CallbackCommand: constant.CallbackBeforeSetMessageReactionExtensionCommand,
SourceID: setReq.SourceID,
OpUserID: setReq.OpUserID,
OpUserID: tracelog.GetOpUserID(ctx),
SessionType: setReq.SessionType,
ReactionExtensionList: setReq.ReactionExtensionList,
ReactionExtensionList: setReq.ReactionExtensions,
ClientMsgID: setReq.ClientMsgID,
IsReact: setReq.IsReact,
IsExternalExtensions: setReq.IsExternalExtensions,
@ -34,7 +34,7 @@ func CallbackSetMessageReactionExtensions(ctx context.Context, setReq *msg.SetMe
return nil
}
func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReactionExtensionsReq) error {
func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessagesReactionExtensionsReq) error {
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
return nil
}
@ -44,7 +44,7 @@ func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReacti
SourceID: setReq.SourceID,
OpUserID: setReq.OpUserID,
SessionType: setReq.SessionType,
ReactionExtensionList: setReq.ReactionExtensionList,
ReactionExtensionList: setReq.ReactionExtensions,
ClientMsgID: setReq.ClientMsgID,
IsExternalExtensions: setReq.IsExternalExtensions,
MsgFirstModifyTime: setReq.MsgFirstModifyTime,
@ -53,31 +53,31 @@ func CallbackDeleteMessageReactionExtensions(setReq *msg.DeleteMessageListReacti
return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
}
func CallbackGetMessageListReactionExtensions(getReq *msg.GetMessageListReactionExtensionsReq) error {
func CallbackGetMessageListReactionExtensions(ctx context.Context, getReq *msg.GetMessagesReactionExtensionsReq) error {
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
return nil
}
req := &cbapi.CallbackGetMessageListReactionExtReq{
OperationID: getReq.OperationID,
OperationID: tracelog.GetOperationID(ctx),
CallbackCommand: constant.CallbackGetMessageListReactionExtensionsCommand,
SourceID: getReq.SourceID,
OpUserID: getReq.OpUserID,
OpUserID: tracelog.GetOperationID(ctx),
SessionType: getReq.SessionType,
TypeKeyList: getReq.TypeKeyList,
MessageKeyList: getReq.MessageReactionKeyList,
TypeKeyList: getReq.TypeKeys,
MessageKeyList: getReq.MessageReactionKeys,
}
resp := &cbapi.CallbackGetMessageListReactionExtResp{}
return http.CallBackPostReturn(cbURL(), req, resp, config.Config.Callback.CallbackAfterSendGroupMsg)
}
func CallbackAddMessageReactionExtensions(setReq *msg.ModifyMessageReactionExtensionsReq) error {
func CallbackAddMessageReactionExtensions(ctx context.Context, setReq *msg.ModifyMessageReactionExtensionsReq) error {
req := &cbapi.CallbackAddMessageReactionExtReq{
OperationID: setReq.OperationID,
OperationID: tracelog.GetOperationID(ctx),
CallbackCommand: constant.CallbackAddMessageListReactionExtensionsCommand,
SourceID: setReq.SourceID,
OpUserID: setReq.OpUserID,
OpUserID: tracelog.GetOperationID(ctx),
SessionType: setReq.SessionType,
ReactionExtensionList: setReq.ReactionExtensionList,
ReactionExtensionList: setReq.ReactionExtensions,
ClientMsgID: setReq.ClientMsgID,
IsReact: setReq.IsReact,
IsExternalExtensions: setReq.IsExternalExtensions,

@ -1,6 +1,7 @@
package msg
import (
"OpenIM/pkg/common/db/cache"
"context"
"time"
)
@ -13,14 +14,16 @@ type MessageLocker interface {
LockGlobalMessage(ctx context.Context, clientMsgID string) (err error)
UnLockGlobalMessage(ctx context.Context, clientMsgID string) (err error)
}
type LockerMessage struct{}
type LockerMessage struct {
cache cache.Model
}
func NewLockerMessage() *LockerMessage {
return &LockerMessage{}
func NewLockerMessage(cache cache.Model) *LockerMessage {
return &LockerMessage{cache: cache}
}
func (l *LockerMessage) LockMessageTypeKey(clientMsgID, typeKey string) (err error) {
func (l *LockerMessage) LockMessageTypeKey(ctx context.Context, clientMsgID, typeKey string) (err error) {
for i := 0; i < 3; i++ {
err = db.DB.LockMessageTypeKey(clientMsgID, typeKey)
err = l.cache.LockMessageTypeKey(ctx, clientMsgID, typeKey)
if err != nil {
time.Sleep(time.Millisecond * 100)
continue
@ -31,9 +34,9 @@ func (l *LockerMessage) LockMessageTypeKey(clientMsgID, typeKey string) (err err
return err
}
func (l *LockerMessage) LockGlobalMessage(clientMsgID string) (err error) {
func (l *LockerMessage) LockGlobalMessage(ctx context.Context, clientMsgID string) (err error) {
for i := 0; i < 3; i++ {
err = db.DB.LockMessageTypeKey(clientMsgID, GlOBLLOCK)
err = l.cache.LockMessageTypeKey(ctx, clientMsgID, GlOBLLOCK)
if err != nil {
time.Sleep(time.Millisecond * 100)
continue
@ -44,9 +47,9 @@ func (l *LockerMessage) LockGlobalMessage(clientMsgID string) (err error) {
return err
}
func (l *LockerMessage) UnLockMessageTypeKey(clientMsgID string, typeKey string) error {
return db.DB.UnLockMessageTypeKey(clientMsgID, typeKey)
func (l *LockerMessage) UnLockMessageTypeKey(ctx context.Context, clientMsgID string, typeKey string) error {
return l.cache.UnLockMessageTypeKey(ctx, clientMsgID, typeKey)
}
func (l *LockerMessage) UnLockGlobalMessage(clientMsgID string) error {
return db.DB.UnLockMessageTypeKey(clientMsgID, GlOBLLOCK)
func (l *LockerMessage) UnLockGlobalMessage(ctx context.Context, clientMsgID string) error {
return l.cache.UnLockMessageTypeKey(ctx, clientMsgID, GlOBLLOCK)
}

@ -1,7 +0,0 @@
package msg
import "context"
func DeleteMessageNotification(ctx context.Context, userID string, seqs []uint32) {
panic("todo")
}

@ -3,7 +3,6 @@ package msg
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/proto/msg"
"OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/utils"
@ -34,27 +33,6 @@ type MessageRevoked struct {
SessionType int32 `json:"sessionType"`
Seq uint32 `json:"seq"`
}
type MsgCallBackReq struct {
SendID string `json:"sendID"`
RecvID string `json:"recvID"`
Content string `json:"content"`
SendTime int64 `json:"sendTime"`
MsgFrom int32 `json:"msgFrom"`
ContentType int32 `json:"contentType"`
SessionType int32 `json:"sessionType"`
PlatformID int32 `json:"senderPlatformID"`
MsgID string `json:"msgID"`
IsOnlineOnly bool `json:"isOnlineOnly"`
}
type MsgCallBackResp struct {
ErrCode int32 `json:"errCode"`
ErrMsg string `json:"errMsg"`
ResponseErrCode int32 `json:"responseErrCode"`
ResponseResult struct {
ModifiedMsg string `json:"modifiedMsg"`
Ext string `json:"ext"`
}
}
func (m *msgServer) userIsMuteAndIsAdminInGroup(ctx context.Context, groupID, userID string) (isMute bool, err error) {
groupMemberInfo, err := m.Group.GetGroupMemberInfo(ctx, groupID, userID)
@ -331,7 +309,7 @@ func valueCopy(pb *msg.SendMsgReq) *msg.SendMsgReq {
}
func (m *msgServer) sendMsgToGroupOptimization(ctx context.Context, list []string, groupPB *msg.SendMsgReq, wg *sync.WaitGroup) error {
msgToMQGroup := msg.MsgDataToMQ{OperationID: tracelog.GetOperationID(ctx), MsgData: groupPB.MsgData}
msgToMQGroup := msg.MsgDataToMQ{MsgData: groupPB.MsgData}
tempOptions := make(map[string]bool, 1)
for k, v := range groupPB.MsgData.Options {
tempOptions[k] = v

@ -52,10 +52,11 @@ func (m *msgServer) sendMsgNotification(ctx context.Context, req *msg.SendMsgReq
return nil, err
}
}
resp.SendTime = msgToMQSingle.MsgData.SendTime
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
resp = &msg.SendMsgResp{
ServerMsgID: msgToMQSingle.MsgData.ServerMsgID,
ClientMsgID: msgToMQSingle.MsgData.ClientMsgID,
SendTime: msgToMQSingle.MsgData.SendTime,
}
return resp, nil
}
@ -90,9 +91,11 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *msg.SendMsgReq)
return nil, err
}
promePkg.Inc(promePkg.SingleChatMsgProcessSuccessCounter)
resp.SendTime = msgToMQSingle.MsgData.SendTime
resp.ServerMsgID = msgToMQSingle.MsgData.ServerMsgID
resp.ClientMsgID = msgToMQSingle.MsgData.ClientMsgID
resp = &msg.SendMsgResp{
ServerMsgID: msgToMQSingle.MsgData.ServerMsgID,
ClientMsgID: msgToMQSingle.MsgData.ClientMsgID,
SendTime: msgToMQSingle.MsgData.SendTime,
}
return resp, nil
}
@ -265,9 +268,9 @@ func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMin
}
resp.MaxSeq = maxSeq
resp.MinSeq = minSeq
if len(req.GroupIDList) > 0 {
if len(req.GroupIDs) > 0 {
resp.GroupMaxAndMinSeq = make(map[string]*sdkws.MaxAndMinSeq)
for _, groupID := range req.GroupIDList {
for _, groupID := range req.GroupIDs {
maxSeq, err := m.MsgDatabase.GetGroupMaxSeq(ctx, groupID)
if err != nil {
return nil, err
@ -285,19 +288,19 @@ func (m *msgServer) GetMaxAndMinSeq(ctx context.Context, req *sdkws.GetMaxAndMin
return resp, nil
}
func (m *msgServer) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqListReq) (*sdkws.PullMessageBySeqListResp, error) {
resp := &sdkws.PullMessageBySeqListResp{GroupMsgDataList: make(map[string]*sdkws.MsgDataList)}
func (m *msgServer) PullMessageBySeqs(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) {
resp := &sdkws.PullMessageBySeqsResp{GroupMsgDataList: make(map[string]*sdkws.MsgDataList)}
msgs, err := m.MsgDatabase.GetMsgBySeqs(ctx, req.UserID, req.Seqs)
if err != nil {
return nil, err
}
resp.List = msgs
for userID, list := range req.GroupSeqList {
msgs, err := m.MsgDatabase.GetMsgBySeqs(ctx, userID, req.Seqs)
for groupID, list := range req.GroupSeqs {
msgs, err := m.MsgDatabase.GetSuperGroupMsgBySeqs(ctx, groupID, list.Seqs)
if err != nil {
return nil, err
}
resp.GroupMsgDataList[userID] = &sdkws.MsgDataList{
resp.GroupMsgDataList[groupID] = &sdkws.MsgDataList{
MsgDataList: msgs,
}
}

@ -2,10 +2,10 @@ package msg
import (
"OpenIM/internal/common/check"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/db/localcache"
"OpenIM/pkg/common/db/relation"
relationTb "OpenIM/pkg/common/db/table/relation"
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/common/prome"
"OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/proto/msg"
@ -13,34 +13,46 @@ import (
)
type msgServer struct {
RegisterCenter discoveryregistry.SvcDiscoveryRegistry
MsgDatabase controller.MsgDatabase
Group *check.GroupChecker
User *check.UserCheck
Conversation *check.ConversationChecker
friend *check.FriendChecker
RegisterCenter discoveryregistry.SvcDiscoveryRegistry
MsgDatabase controller.MsgDatabase
ExtendMsgDatabase controller.ExtendMsgDatabase
Group *check.GroupChecker
User *check.UserCheck
Conversation *check.ConversationChecker
friend *check.FriendChecker
*localcache.GroupLocalCache
black *check.BlackChecker
MessageLocker MessageLocker
}
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
mysql, err := relation.NewGormDB()
rdb, err := cache.NewRedis()
if err != nil {
return err
}
if err := mysql.AutoMigrate(&relationTb.UserModel{}); err != nil {
mongo, err := unrelation.NewMongo()
if err != nil {
return err
}
cacheModel := cache.NewCacheModel(rdb)
msgDocModel := unrelation.NewMsgMongoDriver(mongo.GetDatabase())
extendMsgModel := unrelation.NewExtendMsgSetMongoDriver(mongo.GetDatabase())
extendMsgDatabase := controller.NewExtendMsgDatabase(extendMsgModel)
msgDatabase := controller.NewMsgDatabase(msgDocModel, cacheModel)
s := &msgServer{
Conversation: check.NewConversationChecker(client),
User: check.NewUserCheck(client),
Group: check.NewGroupChecker(client),
//MsgDatabase: controller.MsgDatabase(),
RegisterCenter: client,
GroupLocalCache: localcache.NewGroupMemberIDsLocalCache(client),
black: check.NewBlackChecker(client),
friend: check.NewFriendChecker(client),
Conversation: check.NewConversationChecker(client),
User: check.NewUserCheck(client),
Group: check.NewGroupChecker(client),
MsgDatabase: msgDatabase,
ExtendMsgDatabase: extendMsgDatabase,
RegisterCenter: client,
GroupLocalCache: localcache.NewGroupLocalCache(client),
black: check.NewBlackChecker(client),
friend: check.NewFriendChecker(client),
MessageLocker: NewLockerMessage(cacheModel),
}
s.initPrometheus()
msg.RegisterMsgServer(server, s)

@ -1 +1,28 @@
package third
import (
"OpenIM/pkg/proto/third"
"context"
)
func (t *thirdServer) GetSignalInvitationInfo(ctx context.Context, req *third.GetSignalInvitationInfoReq) (resp *third.GetSignalInvitationInfoResp, err error) {
signalReq, err := t.thirdDatabase.GetSignalInvitationInfoByClientMsgID(ctx, req.ClientMsgID)
if err != nil {
return nil, err
}
resp = &third.GetSignalInvitationInfoResp{}
resp.InvitationInfo = signalReq.Invitation
resp.OfflinePushInfo = signalReq.OfflinePushInfo
return resp, nil
}
func (t *thirdServer) GetSignalInvitationInfoStartApp(ctx context.Context, req *third.GetSignalInvitationInfoStartAppReq) (resp *third.GetSignalInvitationInfoStartAppResp, err error) {
signalReq, err := t.thirdDatabase.GetAvailableSignalInvitationInfo(ctx, req.UserID)
if err != nil {
return nil, err
}
resp = &third.GetSignalInvitationInfoStartAppResp{}
resp.InvitationInfo = signalReq.Invitation
resp.OfflinePushInfo = signalReq.OfflinePushInfo
return resp, nil
}

@ -7,13 +7,13 @@ import (
"OpenIM/pkg/common/db/obj"
"OpenIM/pkg/common/db/relation"
relationTb "OpenIM/pkg/common/db/table/relation"
"OpenIM/pkg/discoveryregistry"
"OpenIM/pkg/proto/third"
"context"
"github.com/OpenIMSDK/openKeeper"
"google.golang.org/grpc"
)
func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
rdb, err := cache.NewRedis()
if err != nil {
return err
@ -30,7 +30,7 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
return err
}
third.RegisterThirdServer(server, &thirdServer{
thirdDatabase: controller.NewThirdDatabase(cache.NewCache(rdb)),
thirdDatabase: controller.NewThirdDatabase(cache.NewCacheModel(rdb)),
userCheck: check.NewUserCheck(client),
s3dataBase: controller.NewS3Database(o, relation.NewObjectHash(db), relation.NewObjectInfo(db), relation.NewObjectPut(db)),
})
@ -43,28 +43,6 @@ type thirdServer struct {
userCheck *check.UserCheck
}
func (t *thirdServer) GetSignalInvitationInfo(ctx context.Context, req *third.GetSignalInvitationInfoReq) (resp *third.GetSignalInvitationInfoResp, err error) {
signalReq, err := t.thirdDatabase.GetSignalInvitationInfoByClientMsgID(ctx, req.ClientMsgID)
if err != nil {
return nil, err
}
resp = &third.GetSignalInvitationInfoResp{}
resp.InvitationInfo = signalReq.Invitation
resp.OfflinePushInfo = signalReq.OfflinePushInfo
return resp, nil
}
func (t *thirdServer) GetSignalInvitationInfoStartApp(ctx context.Context, req *third.GetSignalInvitationInfoStartAppReq) (resp *third.GetSignalInvitationInfoStartAppResp, err error) {
signalReq, err := t.thirdDatabase.GetAvailableSignalInvitationInfo(ctx, req.UserID)
if err != nil {
return nil, err
}
resp = &third.GetSignalInvitationInfoStartAppResp{}
resp.InvitationInfo = signalReq.Invitation
resp.OfflinePushInfo = signalReq.OfflinePushInfo
return resp, nil
}
func (t *thirdServer) FcmUpdateToken(ctx context.Context, req *third.FcmUpdateTokenReq) (resp *third.FcmUpdateTokenResp, err error) {
err = t.thirdDatabase.FcmUpdateToken(ctx, req.Account, int(req.PlatformID), req.FcmToken, req.ExpireTime)
if err != nil {

@ -16,7 +16,6 @@ import (
pbuser "OpenIM/pkg/proto/user"
"OpenIM/pkg/utils"
"context"
"github.com/OpenIMSDK/openKeeper"
"google.golang.org/grpc"
)
@ -30,11 +29,11 @@ type userServer struct {
}
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
gormDB, err := relation.NewGormDB()
db, err := relation.NewGormDB()
if err != nil {
return err
}
if err := gormDB.AutoMigrate(&tablerelation.UserModel{}); err != nil {
if err := db.AutoMigrate(&tablerelation.UserModel{}); err != nil {
return err
}
users := make([]*tablerelation.UserModel, 0)
@ -45,14 +44,13 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k]})
}
u := &userServer{
UserDatabase: controller.NewUserDatabase(relation.NewUserGorm(gormDB)),
UserDatabase: controller.NewUserDatabase(relation.NewUserGorm(db)),
notification: notification.NewCheck(client),
userCheck: check.NewUserCheck(client),
RegisterCenter: client,
}
pbuser.RegisterUserServer(server, u)
u.UserDatabase.InitOnce(context.Background(), users)
return nil
return u.UserDatabase.InitOnce(context.Background(), users)
}
// ok

@ -1,178 +0,0 @@
package task
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
"context"
"fmt"
"github.com/go-redis/redis/v8"
"math"
)
type msgTool struct {
msgInterface controller.MsgDatabase
userInterface controller.UserDatabase
groupDatabase controller.GroupDatabase
}
func (c *msgTool) getCronTaskOperationID() string {
return cronTaskOperationID + utils.OperationIDGenerator()
}
func (c *msgTool) ClearMsgAndFixSeq() {
operationID := c.getCronTaskOperationID()
ctx := context.Background()
tracelog.SetOperationID(ctx, operationID)
log.NewInfo(operationID, "============================ start del cron task ============================")
var err error
userIDList, err := c.userInterface.GetAllUserID(ctx)
if err == nil {
c.ClearUsersMsg(ctx, userIDList)
} else {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
// working group msg clear
superGroupIDList, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
if err == nil {
c.ClearSuperGroupMsg(ctx, superGroupIDList)
} else {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
log.NewInfo(operationID, "============================ start del cron finished ============================")
}
func (c *msgTool) ClearUsersMsg(ctx context.Context, userIDs []string) {
for _, userID := range userIDs {
if err := c.msgInterface.DeleteUserMsgsAndSetMinSeq(ctx, userID, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), userID)
}
_, maxSeqMongo, minSeqCache, maxSeqCache, err := c.msgInterface.GetUserMinMaxSeqInMongoAndCache(ctx, userID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", userID)
continue
}
c.FixUserSeq(ctx, userID, minSeqCache, maxSeqCache)
c.CheckMaxSeqWithMongo(ctx, userID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
}
}
func (c *msgTool) ClearSuperGroupMsg(ctx context.Context, superGroupIDs []string) {
for _, groupID := range superGroupIDs {
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), "FindGroupMemberUserID", err.Error(), groupID)
continue
}
if err := c.msgInterface.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, groupID, userIDs, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "DeleteUserSuperGroupMsgsAndSetMinSeq failed", groupID, userIDs, config.Config.Mongo.DBRetainChatRecords)
}
_, maxSeqMongo, maxSeqCache, err := c.msgInterface.GetSuperGroupMinMaxSeqInMongoAndCache(ctx, groupID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", groupID)
continue
}
for _, userID := range userIDs {
minSeqCache, err := c.msgInterface.GetGroupUserMinSeq(ctx, groupID, userID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), "GetGroupUserMinSeq failed", groupID, userID)
continue
}
c.FixGroupUserSeq(ctx, userID, groupID, minSeqCache, maxSeqCache)
}
c.CheckMaxSeqWithMongo(ctx, groupID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
}
}
func (c *msgTool) FixUserSeq(ctx context.Context, userID string, minSeqCache, maxSeqCache int64) {
if minSeqCache > maxSeqCache {
if err := c.msgInterface.SetUserMinSeq(ctx, userID, maxSeqCache); err != nil {
log.NewError(tracelog.GetOperationID(ctx), "SetUserMinSeq failed", userID, minSeqCache, maxSeqCache)
} else {
log.NewWarn(tracelog.GetOperationID(ctx), "SetUserMinSeq success", userID, minSeqCache, maxSeqCache)
}
}
}
func (c *msgTool) FixGroupUserSeq(ctx context.Context, userID string, groupID string, minSeqCache, maxSeqCache int64) {
if minSeqCache > maxSeqCache {
if err := c.msgInterface.SetGroupUserMinSeq(ctx, groupID, userID, maxSeqCache); err != nil {
log.NewError(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq failed", userID, minSeqCache, maxSeqCache)
} else {
log.NewWarn(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq success", userID, minSeqCache, maxSeqCache)
}
}
}
func (c *msgTool) CheckMaxSeqWithMongo(ctx context.Context, sourceID string, maxSeqCache, maxSeqMongo int64, diffusionType int) {
if math.Abs(float64(maxSeqMongo-maxSeqCache)) > 10 {
log.NewWarn(tracelog.GetOperationID(ctx), "cache max seq and mongo max seq is diff > 10", sourceID, maxSeqCache, maxSeqMongo, diffusionType)
}
}
func (c *msgTool) ShowUserSeqs(ctx context.Context, userID string) {
}
func (c *msgTool) ShowSuperGroupSeqs(ctx context.Context, groupID string) {
}
func (c *msgTool) FixAllSeq(ctx context.Context) {
userIDs, err := c.userInterface.GetAllUserID(ctx)
if err != nil {
panic(err.Error())
}
for _, userID := range userIDs {
userCurrentMinSeq, err := c.msgInterface.GetUserMinSeq(ctx, userID)
if err != nil && err != redis.Nil {
continue
}
userCurrentMaxSeq, err := c.msgInterface.GetUserMaxSeq(ctx, userID)
if err != nil && err != redis.Nil {
continue
}
if userCurrentMinSeq > userCurrentMaxSeq {
if err = c.msgInterface.SetUserMinSeq(ctx, userID, userCurrentMaxSeq); err != nil {
fmt.Println("SetUserMinSeq failed", userID, userCurrentMaxSeq)
}
fmt.Println("fix", userID, userCurrentMaxSeq)
}
}
fmt.Println("fix users seq success")
groupIDs, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
if err != nil {
panic(err.Error())
}
for _, groupID := range groupIDs {
maxSeq, err := c.msgInterface.GetGroupMaxSeq(ctx, groupID)
if err != nil {
fmt.Println("GetGroupMaxSeq failed", groupID)
continue
}
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
if err != nil {
fmt.Println("get groupID", groupID, "failed, try again later")
continue
}
for _, userID := range userIDs {
userMinSeq, err := c.msgInterface.GetGroupUserMinSeq(ctx, groupID, userID)
if err != nil && err != redis.Nil {
fmt.Println("GetGroupUserMinSeq failed", groupID, userID)
continue
}
if userMinSeq > maxSeq {
if err = c.msgInterface.SetGroupUserMinSeq(ctx, groupID, userID, maxSeq); err != nil {
fmt.Println("SetGroupUserMinSeq failed", err.Error(), groupID, userID, maxSeq)
}
fmt.Println("fix", groupID, userID, maxSeq, userMinSeq)
}
}
}
fmt.Println("fix all seq finished")
}

@ -1,56 +0,0 @@
package task
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
"context"
"fmt"
"time"
"github.com/robfig/cron/v3"
)
const cronTaskOperationID = "cronTaskOperationID-"
const moduleName = "cron"
func StartCronTask() error {
log.NewPrivateLog(moduleName)
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
fmt.Println("cron task start, config", config.Config.Mongo.ChatRecordsClearTime)
clearCronTask := msgTool{}
ctx := context.Background()
operationID := clearCronTask.getCronTaskOperationID()
tracelog.SetOperationID(ctx, operationID)
c := cron.New()
_, err := c.AddFunc(config.Config.Mongo.ChatRecordsClearTime, clearCronTask.ClearMsgAndFixSeq)
if err != nil {
fmt.Println("start cron failed", err.Error(), config.Config.Mongo.ChatRecordsClearTime)
return err
}
c.Start()
fmt.Println("start cron task success")
for {
time.Sleep(10 * time.Second)
}
}
func FixSeq(userID, superGroupID string, fixAllSeq bool) {
log.NewPrivateLog(moduleName)
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
clearCronTask := msgTool{}
ctx := context.Background()
operationID := clearCronTask.getCronTaskOperationID()
tracelog.SetOperationID(ctx, operationID)
if userID != "" {
clearCronTask.ClearUsersMsg(ctx, []string{userID})
}
if superGroupID != "" {
clearCronTask.ClearSuperGroupMsg(ctx, []string{superGroupID})
}
if fixAllSeq {
clearCronTask.FixAllSeq(ctx)
}
fmt.Println("fix seq finished")
}

@ -0,0 +1,39 @@
package tools
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
"context"
"fmt"
"github.com/robfig/cron/v3"
"sync"
)
const cronTaskOperationID = "cronTaskOperationID-"
const moduleName = "cron"
func StartCronTask() error {
log.NewPrivateLog(moduleName)
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
fmt.Println("cron task start, config", config.Config.Mongo.ChatRecordsClearTime)
msgTool, err := InitMsgTool()
if err != nil {
return err
}
ctx := context.Background()
operationID := msgTool.getCronTaskOperationID()
tracelog.SetOperationID(ctx, operationID)
c := cron.New()
var wg sync.WaitGroup
wg.Add(1)
_, err = c.AddFunc(config.Config.Mongo.ChatRecordsClearTime, msgTool.AllUserClearMsgAndFixSeq)
if err != nil {
fmt.Println("start cron failed", err.Error(), config.Config.Mongo.ChatRecordsClearTime)
return err
}
c.Start()
wg.Wait()
return nil
}

@ -0,0 +1,235 @@
package tools
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/db/relation"
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
"context"
"fmt"
"github.com/go-redis/redis/v8"
"math"
)
type MsgTool struct {
msgDatabase controller.MsgDatabase
userDatabase controller.UserDatabase
groupDatabase controller.GroupDatabase
}
func NewMsgTool(msgDatabase controller.MsgDatabase, userDatabase controller.UserDatabase, groupDatabase controller.GroupDatabase) *MsgTool {
return &MsgTool{
msgDatabase: msgDatabase,
userDatabase: userDatabase,
groupDatabase: groupDatabase,
}
}
func InitMsgTool() (*MsgTool, error) {
rdb, err := cache.NewRedis()
if err != nil {
return nil, err
}
mongo, err := unrelation.NewMongo()
if err != nil {
return nil, err
}
db, err := relation.NewGormDB()
if err != nil {
return nil, err
}
msgDatabase := controller.InitMsgDatabase(rdb, mongo.GetDatabase())
userDatabase := controller.NewUserDatabase(relation.NewUserGorm(db))
groupDatabase := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase())
msgTool := NewMsgTool(msgDatabase, userDatabase, groupDatabase)
return msgTool, nil
}
func (c *MsgTool) getCronTaskOperationID() string {
return cronTaskOperationID + utils.OperationIDGenerator()
}
func (c *MsgTool) AllUserClearMsgAndFixSeq() {
operationID := c.getCronTaskOperationID()
ctx := context.Background()
tracelog.SetOperationID(ctx, operationID)
log.NewInfo(operationID, "============================ start del cron task ============================")
var err error
userIDList, err := c.userDatabase.GetAllUserID(ctx)
if err == nil {
c.ClearUsersMsg(ctx, userIDList)
} else {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
// working group msg clear
superGroupIDList, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
if err == nil {
c.ClearSuperGroupMsg(ctx, superGroupIDList)
} else {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
log.NewInfo(operationID, "============================ start del cron finished ============================")
}
func (c *MsgTool) ClearUsersMsg(ctx context.Context, userIDs []string) {
for _, userID := range userIDs {
if err := c.msgDatabase.DeleteUserMsgsAndSetMinSeq(ctx, userID, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), userID)
}
maxSeqCache, maxSeqMongo, err := c.GetAndFixUserSeqs(ctx, userID)
if err != nil {
continue
}
c.CheckMaxSeqWithMongo(ctx, userID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
}
}
func (c *MsgTool) ClearSuperGroupMsg(ctx context.Context, superGroupIDs []string) {
for _, groupID := range superGroupIDs {
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), "FindGroupMemberUserID", err.Error(), groupID)
continue
}
if err := c.msgDatabase.DeleteUserSuperGroupMsgsAndSetMinSeq(ctx, groupID, userIDs, int64(config.Config.Mongo.DBRetainChatRecords*24*60*60)); err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "DeleteUserSuperGroupMsgsAndSetMinSeq failed", groupID, userIDs, config.Config.Mongo.DBRetainChatRecords)
}
if err := c.fixGroupSeq(ctx, groupID, userIDs); err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), groupID, userIDs)
}
}
}
func (c *MsgTool) FixGroupSeq(ctx context.Context, groupID string) error {
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
if err != nil {
return err
}
return c.fixGroupSeq(ctx, groupID, userIDs)
}
func (c *MsgTool) fixGroupSeq(ctx context.Context, groupID string, userIDs []string) error {
_, maxSeqMongo, maxSeqCache, err := c.msgDatabase.GetSuperGroupMinMaxSeqInMongoAndCache(ctx, groupID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", groupID)
return err
}
for _, userID := range userIDs {
if _, err := c.GetAndFixGroupUserSeq(ctx, userID, groupID, maxSeqCache); err != nil {
log.NewError(tracelog.GetOperationID(ctx), "GetAndFixGroupUserSeq failed", groupID, userID, maxSeqCache)
continue
}
}
c.CheckMaxSeqWithMongo(ctx, groupID, maxSeqCache, maxSeqMongo, constant.WriteDiffusion)
return nil
}
func (c *MsgTool) GetAndFixUserSeqs(ctx context.Context, userID string) (maxSeqCache, maxSeqMongo int64, err error) {
_, maxSeqMongo, minSeqCache, maxSeqCache, err := c.msgDatabase.GetUserMinMaxSeqInMongoAndCache(ctx, userID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), err.Error(), "GetUserMinMaxSeqInMongoAndCache failed", userID)
return 0, 0, err
}
if minSeqCache > maxSeqCache {
if err := c.msgDatabase.SetUserMinSeq(ctx, userID, maxSeqCache); err != nil {
log.NewError(tracelog.GetOperationID(ctx), "SetUserMinSeq failed", userID, minSeqCache, maxSeqCache)
} else {
log.NewWarn(tracelog.GetOperationID(ctx), "SetUserMinSeq success", userID, minSeqCache, maxSeqCache)
}
}
return maxSeqCache, maxSeqMongo, nil
}
func (c *MsgTool) GetAndFixGroupUserSeq(ctx context.Context, userID string, groupID string, maxSeqCache int64) (minSeqCache int64, err error) {
minSeqCache, err = c.msgDatabase.GetGroupUserMinSeq(ctx, groupID, userID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), "GetGroupUserMinSeq failed", groupID, userID)
return 0, err
}
if minSeqCache > maxSeqCache {
if err := c.msgDatabase.SetGroupUserMinSeq(ctx, groupID, userID, maxSeqCache); err != nil {
log.NewError(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq failed", userID, minSeqCache, maxSeqCache)
} else {
log.NewWarn(tracelog.GetOperationID(ctx), "SetGroupUserMinSeq success", userID, minSeqCache, maxSeqCache)
}
}
return minSeqCache, nil
}
func (c *MsgTool) CheckMaxSeqWithMongo(ctx context.Context, sourceID string, maxSeqCache, maxSeqMongo int64, diffusionType int) {
if math.Abs(float64(maxSeqMongo-maxSeqCache)) > 10 {
log.NewWarn(tracelog.GetOperationID(ctx), "cache max seq and mongo max seq is diff > 10", sourceID, maxSeqCache, maxSeqMongo, diffusionType)
}
}
func (c *MsgTool) ShowUserSeqs(ctx context.Context, userID string) {
}
func (c *MsgTool) ShowSuperGroupSeqs(ctx context.Context, groupID string) {
}
func (c *MsgTool) ShowSuperGroupUserSeqs(ctx context.Context, groupID, userID string) {
}
func (c *MsgTool) FixAllSeq(ctx context.Context) {
userIDs, err := c.userDatabase.GetAllUserID(ctx)
if err != nil {
panic(err.Error())
}
for _, userID := range userIDs {
userCurrentMinSeq, err := c.msgDatabase.GetUserMinSeq(ctx, userID)
if err != nil && err != redis.Nil {
continue
}
userCurrentMaxSeq, err := c.msgDatabase.GetUserMaxSeq(ctx, userID)
if err != nil && err != redis.Nil {
continue
}
if userCurrentMinSeq > userCurrentMaxSeq {
if err = c.msgDatabase.SetUserMinSeq(ctx, userID, userCurrentMaxSeq); err != nil {
fmt.Println("SetUserMinSeq failed", userID, userCurrentMaxSeq)
}
fmt.Println("fix", userID, userCurrentMaxSeq)
}
}
fmt.Println("fix users seq success")
groupIDs, err := c.groupDatabase.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
if err != nil {
panic(err.Error())
}
for _, groupID := range groupIDs {
maxSeq, err := c.msgDatabase.GetGroupMaxSeq(ctx, groupID)
if err != nil {
fmt.Println("GetGroupMaxSeq failed", groupID)
continue
}
userIDs, err := c.groupDatabase.FindGroupMemberUserID(ctx, groupID)
if err != nil {
fmt.Println("get groupID", groupID, "failed, try again later")
continue
}
for _, userID := range userIDs {
userMinSeq, err := c.msgDatabase.GetGroupUserMinSeq(ctx, groupID, userID)
if err != nil && err != redis.Nil {
fmt.Println("GetGroupUserMinSeq failed", groupID, userID)
continue
}
if userMinSeq > maxSeq {
if err = c.msgDatabase.SetGroupUserMinSeq(ctx, groupID, userID, maxSeq); err != nil {
fmt.Println("SetGroupUserMinSeq failed", err.Error(), groupID, userID, maxSeq)
}
fmt.Println("fix", groupID, userID, maxSeq, userMinSeq)
}
}
}
fmt.Println("fix all seq finished")
}

@ -1,4 +1,4 @@
package task
package tools
import (
"OpenIM/pkg/common/constant"
@ -16,12 +16,7 @@ import (
"time"
)
var (
redisClient *redis.Client
mongoClient *mongo.Collection
)
func GenUserChat(startSeq, stopSeq, delSeq, index uint32, userID string) *mongo2.UserChat {
func GenUserChat(startSeq, stopSeq, delSeq, index int64, userID string) *mongo2.UserChat {
chat := &mongo2.UserChat{UID: userID + strconv.Itoa(int(index))}
for i := startSeq; i <= stopSeq; i++ {
msg := sdkws.MsgData{
@ -36,8 +31,8 @@ func GenUserChat(startSeq, stopSeq, delSeq, index uint32, userID string) *mongo2
SessionType: 1,
MsgFrom: 100,
ContentType: 101,
Content: []byte("testFaceURL"),
Seq: uint32(i),
Content: []byte("testFaceURL.com"),
Seq: i,
SendTime: time.Now().Unix(),
CreateTime: time.Now().Unix(),
Status: 1,
@ -89,15 +84,4 @@ func TestDeleteUserMsgsAndSetMinSeq(t *testing.T) {
if err != nil {
t.Error("err is not nil", testUID1, err.Error())
}
// testWorkingGroupIDList := []string{"test_del_id1", "test_del_id2", "test_del_id3", "test_del_id4", "test_del_id5"}
// for _, groupID := range testWorkingGroupIDList {
// operationID = groupID + "-" + operationID
// log.NewDebug(operationID, utils.GetSelfFuncName(), "groupID:", groupID, "userIDList:", testUserIDList)
// if err := DeleteUserSuperGroupMsgsAndSetMinSeq(operationID, groupID, testUserIDList); err != nil {
// t.Error("checkMaxSeqWithMongo failed", groupID)
// }
// if err := checkMaxSeqWithMongo(operationID, groupID, constant.ReadDiffusion); err != nil {
// t.Error("checkMaxSeqWithMongo failed", groupID)
// }
// }
}

@ -195,17 +195,6 @@ type config struct {
}
Push struct {
Tpns struct {
Ios struct {
AccessID string `yaml:"accessID"`
SecretKey string `yaml:"secretKey"`
}
Android struct {
AccessID string `yaml:"accessID"`
SecretKey string `yaml:"secretKey"`
}
Enable bool `yaml:"enable"`
}
Jpns struct {
AppKey string `yaml:"appKey"`
MasterSecret string `yaml:"masterSecret"`
@ -216,7 +205,7 @@ type config struct {
Getui struct {
PushUrl string `yaml:"pushUrl"`
AppKey string `yaml:"appKey"`
Enable *bool `yaml:"enable"`
Enable bool `yaml:"enable"`
Intent string `yaml:"intent"`
MasterSecret string `yaml:"masterSecret"`
ChannelID string `yaml:"channelID"`
@ -226,13 +215,6 @@ type config struct {
ServiceAccount string `yaml:"serviceAccount"`
Enable bool `yaml:"enable"`
}
Mob struct {
AppKey string `yaml:"appKey"`
PushUrl string `yaml:"pushUrl"`
Scheme string `yaml:"scheme"`
AppSecret string `yaml:"appSecret"`
Enable bool `yaml:"enable"`
}
}
Manager struct {
AppManagerUid []string `yaml:"appManagerUid"`

@ -280,6 +280,9 @@ const (
Female = 2
)
const OperationID = "operationID"
const OpUserID = "opUserID"
const (
UnreliableNotification = 1
ReliableNotificationNoMsg = 2

@ -37,7 +37,7 @@ const (
uidPidToken = "UID_PID_TOKEN_STATUS:"
)
type Cache interface {
type Model interface {
IncrUserSeq(ctx context.Context, userID string) (int64, error)
GetUserMaxSeq(ctx context.Context, userID string) (int64, error)
SetUserMaxSeq(ctx context.Context, userID string, maxSeq int64) error
@ -75,7 +75,7 @@ type Cache interface {
IncrUserBadgeUnreadCountSum(ctx context.Context, userID string) (int, error)
SetUserBadgeUnreadCountSum(ctx context.Context, userID string, value int) error
GetUserBadgeUnreadCountSum(ctx context.Context, userID string) (int, error)
JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
GetOneMessageAllReactionList(ctx context.Context, clientMsgID string, sessionType int32) (map[string]string, error)
DeleteOneMessageKey(ctx context.Context, clientMsgID string, sessionType int32, subKey string) error
SetMessageReactionExpire(ctx context.Context, clientMsgID string, sessionType int32, expiration time.Duration) (bool, error)
@ -85,7 +85,7 @@ type Cache interface {
UnLockMessageTypeKey(ctx context.Context, clientMsgID string, TypeKey string) error
}
func NewCache(client redis.UniversalClient) Cache {
func NewCacheModel(client redis.UniversalClient) Model {
return &cache{rdb: client}
}
@ -205,7 +205,7 @@ func (c *cache) GetMessagesBySeq(ctx context.Context, userID string, seqList []i
func (c *cache) SetMessageToCache(ctx context.Context, userID string, msgList []*pbMsg.MsgDataToMQ) (int, error) {
pipe := c.rdb.Pipeline()
var failedList []pbMsg.MsgDataToMQ
var failedMsgs []pbMsg.MsgDataToMQ
for _, msg := range msgList {
key := messageCache + userID + "_" + strconv.Itoa(int(msg.MsgData.Seq))
s, err := utils.Pb2String(msg.MsgData)
@ -217,8 +217,8 @@ func (c *cache) SetMessageToCache(ctx context.Context, userID string, msgList []
return 0, utils.Wrap1(err)
}
}
if len(failedList) != 0 {
return len(failedList), errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, tracelog.GetOperationID(ctx)))
if len(failedMsgs) != 0 {
return len(failedMsgs), errors.New(fmt.Sprintf("set msg to cache failed, failed lists: %q,%s", failedList, tracelog.GetOperationID(ctx)))
}
_, err := pipe.Exec(ctx)
return 0, err
@ -434,7 +434,7 @@ func (c *cache) getMessageReactionExPrefix(clientMsgID string, sessionType int32
return ""
}
func (c *cache) JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
func (c *cache) JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
n, err := c.rdb.Exists(ctx, c.getMessageReactionExPrefix(clientMsgID, sessionType)).Result()
if err != nil {
return false, utils.Wrap(err, "")

@ -17,13 +17,13 @@ type AuthDatabase interface {
}
type authDatabase struct {
cache cache.Cache
cache cache.Model
accessSecret string
accessExpire int64
}
func NewAuthDatabase(cache cache.Cache, accessSecret string, accessExpire int64) AuthDatabase {
func NewAuthDatabase(cache cache.Model, accessSecret string, accessExpire int64) AuthDatabase {
return &authDatabase{cache: cache, accessSecret: accessSecret, accessExpire: accessExpire}
}

@ -2,7 +2,6 @@ package controller
import (
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
"OpenIM/pkg/proto/sdkws"
"context"
)
@ -11,42 +10,42 @@ type ExtendMsgDatabase interface {
GetAllExtendMsgSet(ctx context.Context, ID string, opts *unRelationTb.GetAllExtendMsgSetOpts) (sets []*unRelationTb.ExtendMsgSetModel, err error)
GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*unRelationTb.ExtendMsgSetModel, error)
InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *unRelationTb.ExtendMsgModel) error
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error
GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error)
}
type extendMsgDatabase struct {
db unRelationTb.ExtendMsgSetModelInterface
database unRelationTb.ExtendMsgSetModelInterface
}
func NewExtendMsgDatabase() ExtendMsgDatabase {
return &extendMsgDatabase{}
func NewExtendMsgDatabase(extendMsgModel unRelationTb.ExtendMsgSetModelInterface) ExtendMsgDatabase {
return &extendMsgDatabase{database: extendMsgModel}
}
func (e *extendMsgDatabase) CreateExtendMsgSet(ctx context.Context, set *unRelationTb.ExtendMsgSetModel) error {
return e.db.CreateExtendMsgSet(ctx, set)
return e.database.CreateExtendMsgSet(ctx, set)
}
func (e *extendMsgDatabase) GetAllExtendMsgSet(ctx context.Context, sourceID string, opts *unRelationTb.GetAllExtendMsgSetOpts) (sets []*unRelationTb.ExtendMsgSetModel, err error) {
return e.db.GetAllExtendMsgSet(ctx, sourceID, opts)
return e.database.GetAllExtendMsgSet(ctx, sourceID, opts)
}
func (e *extendMsgDatabase) GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*unRelationTb.ExtendMsgSetModel, error) {
return e.db.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
return e.database.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
}
func (e *extendMsgDatabase) InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *unRelationTb.ExtendMsgModel) error {
return e.db.InsertExtendMsg(ctx, sourceID, sessionType, msg)
return e.database.InsertExtendMsg(ctx, sourceID, sessionType, msg)
}
func (e *extendMsgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
return e.db.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
func (e *extendMsgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
return e.database.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
}
func (e *extendMsgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
return e.db.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
func (e *extendMsgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
return e.database.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, reactionExtensionList)
}
func (e *extendMsgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
return e.db.TakeExtendMsg(ctx, sourceID, sessionType, clientMsgID, maxMsgUpdateTime)
return e.database.TakeExtendMsg(ctx, sourceID, sessionType, clientMsgID, maxMsgUpdateTime)
}

@ -3,13 +3,19 @@ package controller
import (
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/relation"
relationTb "OpenIM/pkg/common/db/table/relation"
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
"OpenIM/pkg/common/db/tx"
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/utils"
"context"
"fmt"
"github.com/dtm-labs/rockscache"
_ "github.com/dtm-labs/rockscache"
"github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/mongo"
"gorm.io/gorm"
)
type GroupDatabase interface {
@ -69,6 +75,21 @@ func NewGroupDatabase(
return database
}
func InitGroupDatabase(db *gorm.DB, rdb redis.UniversalClient, database *mongo.Database) GroupDatabase {
return NewGroupDatabase(
relation.NewGroupDB(db),
relation.NewGroupMemberDB(db),
relation.NewGroupRequest(db),
tx.NewGorm(db),
tx.NewMongo(database.Client()),
unrelation.NewSuperGroupMongoDriver(database),
cache.NewGroupCacheRedis(rdb, relation.NewGroupDB(db), relation.NewGroupMemberDB(db), relation.NewGroupRequest(db), unrelation.NewSuperGroupMongoDriver(database), rockscache.Options{
StrongConsistency: true,
RandomExpireAdjustment: 2.0,
}),
)
}
type groupDatabase struct {
groupDB relationTb.GroupModelInterface
groupMemberDB relationTb.GroupMemberModelInterface

@ -3,6 +3,8 @@ package controller
import (
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/cache"
"OpenIM/pkg/common/db/relation"
relationTb "OpenIM/pkg/common/db/table/relation"
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/common/log"
@ -10,6 +12,7 @@ import (
"OpenIM/pkg/common/tracelog"
"fmt"
"github.com/gogo/protobuf/sortkeys"
"gorm.io/gorm"
"sync"
"time"
@ -55,7 +58,7 @@ type MsgDatabase interface {
// 设置用户最小seq 直接调用cache
SetUserMinSeq(ctx context.Context, userID string, minSeq int64) (err error)
JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error)
SetMessageTypeKeyValue(ctx context.Context, clientMsgID string, sessionType int32, typeKey, value string) error
@ -75,22 +78,31 @@ type MsgDatabase interface {
GetGroupMinSeq(ctx context.Context, groupID string) (int64, error)
}
func NewMsgDatabase(mgo *mongo.Client, rdb redis.UniversalClient) MsgDatabase {
return &msgDatabase{}
func NewMsgDatabase(msgDocModel unRelationTb.MsgDocModelInterface, cacheModel cache.Model) MsgDatabase {
return &msgDatabase{
msgDocModel: msgDocModel,
cache: cacheModel,
}
}
func InitMsgDatabase(rdb redis.UniversalClient, database *mongo.Database) MsgDatabase {
cacheModel := cache.NewCacheModel(rdb)
msgDocModel := unrelation.NewMsgMongoDriver(database)
msgDatabase := NewMsgDatabase(msgDocModel, cacheModel)
return msgDatabase
}
type msgDatabase struct {
mgo unRelationTb.MsgDocModelInterface
cache cache.Cache
msg unRelationTb.MsgDocModel
ExtendMsg unRelationTb.ExtendMsgSetModelInterface
rdb redis.Client
msgDocModel unRelationTb.MsgDocModelInterface
cache cache.Model
msg unRelationTb.MsgDocModel
extendMsgModel unRelationTb.ExtendMsgSetModelInterface
}
func (db *msgDatabase) reactionExtensionList(reactionExtensionList map[string]*sdkws.KeyValue) map[string]unRelationTb.KeyValueModel {
r := make(map[string]unRelationTb.KeyValueModel)
func (db *msgDatabase) reactionExtensionList(reactionExtensionList map[string]*sdkws.KeyValue) map[string]*unRelationTb.KeyValueModel {
r := make(map[string]*unRelationTb.KeyValueModel)
for key, value := range reactionExtensionList {
r[key] = unRelationTb.KeyValueModel{
r[key] = &unRelationTb.KeyValueModel{
TypeKey: value.TypeKey,
Value: value.Value,
LatestUpdateTime: value.LatestUpdateTime,
@ -99,8 +111,8 @@ func (db *msgDatabase) reactionExtensionList(reactionExtensionList map[string]*s
return r
}
func (db *msgDatabase) JudgeMessageReactionEXISTS(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
return db.cache.JudgeMessageReactionEXISTS(ctx, clientMsgID, sessionType)
func (db *msgDatabase) JudgeMessageReactionExist(ctx context.Context, clientMsgID string, sessionType int32) (bool, error) {
return db.cache.JudgeMessageReactionExist(ctx, clientMsgID, sessionType)
}
func (db *msgDatabase) SetMessageTypeKeyValue(ctx context.Context, clientMsgID string, sessionType int32, typeKey, value string) error {
@ -123,12 +135,12 @@ func (db *msgDatabase) DeleteOneMessageKey(ctx context.Context, clientMsgID stri
return db.cache.DeleteOneMessageKey(ctx, clientMsgID, sessionType, subKey)
}
func (db *msgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
return db.ExtendMsg.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensionList))
func (db *msgDatabase) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensions map[string]*sdkws.KeyValue) error {
return db.extendMsgModel.InsertOrUpdateReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensions))
}
func (db *msgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (*pbMsg.ExtendMsg, error) {
extendMsgSet, err := db.ExtendMsg.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
extendMsgSet, err := db.extendMsgModel.GetExtendMsgSet(ctx, sourceID, sessionType, maxMsgUpdateTime)
if err != nil {
return nil, err
}
@ -147,16 +159,16 @@ func (db *msgDatabase) GetExtendMsg(ctx context.Context, sourceID string, sessio
}
}
return &pbMsg.ExtendMsg{
ReactionExtensionList: reactionExtensionList,
ClientMsgID: extendMsg.ClientMsgID,
MsgFirstModifyTime: extendMsg.MsgFirstModifyTime,
AttachedInfo: extendMsg.AttachedInfo,
Ex: extendMsg.Ex,
ReactionExtensions: reactionExtensionList,
ClientMsgID: extendMsg.ClientMsgID,
MsgFirstModifyTime: extendMsg.MsgFirstModifyTime,
AttachedInfo: extendMsg.AttachedInfo,
Ex: extendMsg.Ex,
}, nil
}
func (db *msgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
return db.ExtendMsg.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensionList))
func (db *msgDatabase) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensions map[string]*sdkws.KeyValue) error {
return db.extendMsgModel.DeleteReactionExtendMsgSet(ctx, sourceID, sessionType, clientMsgID, msgFirstModifyTime, db.reactionExtensionList(reactionExtensions))
}
func (db *msgDatabase) SetSendMsgStatus(ctx context.Context, id string, status int32) error {
@ -235,13 +247,13 @@ func (db *msgDatabase) BatchInsertChat2DB(ctx context.Context, sourceID string,
//filter := bson.M{"uid": seqUid}
//log.NewDebug(operationID, "filter ", seqUid, "list ", msgListToMongo, "userID: ", userID)
//err := c.FindOneAndUpdate(ctx, filter, bson.M{"$push": bson.M{"msg": bson.M{"$each": msgsToMongo}}}).Err()
err = db.mgo.PushMsgsToDoc(ctx, docID, msgsToMongo)
err = db.msgDocModel.PushMsgsToDoc(ctx, docID, msgsToMongo)
if err != nil {
if err == mongo.ErrNoDocuments {
doc := &unRelationTb.MsgDocModel{}
doc.DocID = docID
doc.Msg = msgsToMongo
if err = db.mgo.Create(ctx, doc); err != nil {
if err = db.msgDocModel.Create(ctx, doc); err != nil {
prome.Inc(prome.MsgInsertMongoFailedCounter)
//log.NewError(operationID, "InsertOne failed", filter, err.Error(), sChat)
return utils.Wrap(err, "")
@ -261,7 +273,7 @@ func (db *msgDatabase) BatchInsertChat2DB(ctx context.Context, sourceID string,
nextDoc.DocID = docIDNext
nextDoc.Msg = msgsToMongoNext
//log.NewDebug(operationID, "filter ", seqUidNext, "list ", msgListToMongoNext, "userID: ", userID)
if err = db.mgo.Create(ctx, nextDoc); err != nil {
if err = db.msgDocModel.Create(ctx, nextDoc); err != nil {
prome.Inc(prome.MsgInsertMongoFailedCounter)
//log.NewError(operationID, "InsertOne failed", filter, err.Error(), sChat)
return utils.Wrap(err, "")
@ -355,7 +367,7 @@ func (db *msgDatabase) DelMsgBySeqsInOneDoc(ctx context.Context, docID string, s
return nil, err
}
for i, v := range seqMsgs {
if err = db.mgo.UpdateMsgStatusByIndexInOneDoc(ctx, docID, v, indexes[i], constant.MsgDeleted); err != nil {
if err = db.msgDocModel.UpdateMsgStatusByIndexInOneDoc(ctx, docID, v, indexes[i], constant.MsgDeleted); err != nil {
return nil, err
}
}
@ -363,7 +375,7 @@ func (db *msgDatabase) DelMsgBySeqsInOneDoc(ctx context.Context, docID string, s
}
func (db *msgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID string, seqs []int64) (seqMsgs []*sdkws.MsgData, indexes []int, unExistSeqs []int64, err error) {
doc, err := db.mgo.FindOneByDocID(ctx, docID)
doc, err := db.msgDocModel.FindOneByDocID(ctx, docID)
if err != nil {
return nil, nil, nil, err
}
@ -394,7 +406,7 @@ func (db *msgDatabase) GetMsgAndIndexBySeqsInOneDoc(ctx context.Context, docID s
}
func (db *msgDatabase) GetNewestMsg(ctx context.Context, sourceID string) (msgPb *sdkws.MsgData, err error) {
msgInfo, err := db.mgo.GetNewestMsg(ctx, sourceID)
msgInfo, err := db.msgDocModel.GetNewestMsg(ctx, sourceID)
if err != nil {
return nil, err
}
@ -402,7 +414,7 @@ func (db *msgDatabase) GetNewestMsg(ctx context.Context, sourceID string) (msgPb
}
func (db *msgDatabase) GetOldestMsg(ctx context.Context, sourceID string) (msgPb *sdkws.MsgData, err error) {
msgInfo, err := db.mgo.GetOldestMsg(ctx, sourceID)
msgInfo, err := db.msgDocModel.GetOldestMsg(ctx, sourceID)
if err != nil {
return nil, err
}
@ -423,7 +435,7 @@ func (db *msgDatabase) getMsgBySeqs(ctx context.Context, sourceID string, seqs [
singleCount := 0
m := db.msg.GetDocIDSeqsMap(sourceID, seqs)
for docID, value := range m {
doc, err := db.mgo.FindOneByDocID(ctx, docID)
doc, err := db.msgDocModel.FindOneByDocID(ctx, docID)
if err != nil {
//log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error())
continue
@ -566,7 +578,7 @@ func (d *delMsgRecursionStruct) getSetMinSeq() int64 {
// recursion 删除list并且返回设置的最小seq
func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string, index int64, delStruct *delMsgRecursionStruct, remainTime int64) (int64, error) {
// find from oldest list
msgs, err := db.mgo.GetMsgsByIndex(ctx, sourceID, index)
msgs, err := db.msgDocModel.GetMsgsByIndex(ctx, sourceID, index)
if err != nil || msgs.DocID == "" {
if err != nil {
if err == unrelation.ErrMsgListNotExist {
@ -576,7 +588,7 @@ func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string,
}
}
// 获取报错或者获取不到了物理删除并且返回seq delMongoMsgsPhysical(delStruct.delDocIDList)
err = db.mgo.Delete(ctx, delStruct.delDocIDs)
err = db.msgDocModel.Delete(ctx, delStruct.delDocIDs)
if err != nil {
return 0, err
}
@ -611,11 +623,11 @@ func (db *msgDatabase) deleteMsgRecursion(ctx context.Context, sourceID string,
msg.SendTime = 0
hasMarkDelFlag = true
} else {
if err := db.mgo.Delete(ctx, delStruct.delDocIDs); err != nil {
if err := db.msgDocModel.Delete(ctx, delStruct.delDocIDs); err != nil {
return 0, err
}
if hasMarkDelFlag {
if err := db.mgo.UpdateOneDoc(ctx, msgs); err != nil {
if err := db.msgDocModel.UpdateOneDoc(ctx, msgs); err != nil {
return delStruct.getSetMinSeq(), utils.Wrap(err, "")
}
}
@ -659,7 +671,7 @@ func (db *msgDatabase) GetSuperGroupMinMaxSeqInMongoAndCache(ctx context.Context
}
func (db *msgDatabase) GetMinMaxSeqMongo(ctx context.Context, sourceID string) (minSeqMongo, maxSeqMongo int64, err error) {
oldestMsgMongo, err := db.mgo.GetOldestMsg(ctx, sourceID)
oldestMsgMongo, err := db.msgDocModel.GetOldestMsg(ctx, sourceID)
if err != nil {
return 0, 0, err
}
@ -668,7 +680,7 @@ func (db *msgDatabase) GetMinMaxSeqMongo(ctx context.Context, sourceID string) (
return 0, 0, err
}
minSeqMongo = msgPb.Seq
newestMsgMongo, err := db.mgo.GetNewestMsg(ctx, sourceID)
newestMsgMongo, err := db.msgDocModel.GetNewestMsg(ctx, sourceID)
if err != nil {
return 0, 0, err
}

@ -12,10 +12,10 @@ type PushDatabase interface {
}
type pushDataBase struct {
cache cache.Cache
cache cache.Model
}
func NewPushDatabase(cache cache.Cache) PushDatabase {
func NewPushDatabase(cache cache.Model) PushDatabase {
return &pushDataBase{cache: cache}
}

@ -14,10 +14,10 @@ type ThirdDatabase interface {
}
type thirdDatabase struct {
cache cache.Cache
cache cache.Model
}
func NewThirdDatabase(cache cache.Cache) ThirdDatabase {
func NewThirdDatabase(cache cache.Model) ThirdDatabase {
return &thirdDatabase{cache: cache}
}

@ -18,8 +18,8 @@ type ConversationLocalCache struct {
client discoveryregistry.SvcDiscoveryRegistry
}
func NewConversationLocalCache(client discoveryregistry.SvcDiscoveryRegistry) ConversationLocalCache {
return ConversationLocalCache{
func NewConversationLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *ConversationLocalCache {
return &ConversationLocalCache{
SuperGroupRecvMsgNotNotifyUserIDs: make(map[string][]string, 0),
client: client,
}

@ -24,7 +24,7 @@ type GroupMemberIDsHash struct {
userIDs []string
}
func NewGroupMemberIDsLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *GroupLocalCache {
func NewGroupLocalCache(client discoveryregistry.SvcDiscoveryRegistry) *GroupLocalCache {
return &GroupLocalCache{
cache: make(map[string]GroupMemberIDsHash, 0),
client: client,

@ -17,7 +17,7 @@ type ChatLogGorm struct {
DB *gorm.DB
}
func NewChatLogGorm(db *gorm.DB) *ChatLogGorm {
func NewChatLogGorm(db *gorm.DB) relation.ChatLogModelInterface {
return &ChatLogGorm{DB: db}
}

@ -1,7 +1,6 @@
package unrelation
import (
"OpenIM/pkg/proto/sdkws"
"context"
"strconv"
"strings"
@ -41,8 +40,8 @@ type ExtendMsgSetModelInterface interface {
GetAllExtendMsgSet(ctx context.Context, sourceID string, opts *GetAllExtendMsgSetOpts) (sets []*ExtendMsgSetModel, err error)
GetExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, maxMsgUpdateTime int64) (*ExtendMsgSetModel, error)
InsertExtendMsg(ctx context.Context, sourceID string, sessionType int32, msg *ExtendMsgModel) error
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error
InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*KeyValueModel) error
DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*KeyValueModel) error
TakeExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *ExtendMsgModel, err error)
}

@ -2,7 +2,6 @@ package unrelation
import (
unRelationTb "OpenIM/pkg/common/db/table/unrelation"
"OpenIM/pkg/proto/sdkws"
"OpenIM/pkg/utils"
"context"
"errors"
@ -18,7 +17,7 @@ type ExtendMsgSetMongoDriver struct {
ExtendMsgSetCollection *mongo.Collection
}
func NewExtendMsgSetMongoDriver(mgoDB *mongo.Database) *ExtendMsgSetMongoDriver {
func NewExtendMsgSetMongoDriver(mgoDB *mongo.Database) unRelationTb.ExtendMsgSetModelInterface {
return &ExtendMsgSetMongoDriver{mgoDB: mgoDB, ExtendMsgSetCollection: mgoDB.Collection(unRelationTb.CExtendMsgSet)}
}
@ -95,7 +94,7 @@ func (e *ExtendMsgSetMongoDriver) InsertExtendMsg(ctx context.Context, sourceID
}
// insert or update
func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
var updateBson = bson.M{}
for _, v := range reactionExtensionList {
updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = v
@ -116,7 +115,7 @@ func (e *ExtendMsgSetMongoDriver) InsertOrUpdateReactionExtendMsgSet(ctx context
}
// delete TypeKey
func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*sdkws.KeyValue) error {
func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, msgFirstModifyTime int64, reactionExtensionList map[string]*unRelationTb.KeyValueModel) error {
var updateBson = bson.M{}
for _, v := range reactionExtensionList {
updateBson[fmt.Sprintf("extend_msgs.%s.%s", clientMsgID, v.TypeKey)] = ""
@ -132,7 +131,7 @@ func (e *ExtendMsgSetMongoDriver) DeleteReactionExtendMsgSet(ctx context.Context
return err
}
func (e *ExtendMsgSetMongoDriver) GetExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
func (e *ExtendMsgSetMongoDriver) TakeExtendMsg(ctx context.Context, sourceID string, sessionType int32, clientMsgID string, maxMsgUpdateTime int64) (extendMsg *unRelationTb.ExtendMsgModel, err error) {
findOpts := options.Find().SetLimit(1).SetSkip(0).SetSort(bson.M{"source_id": -1}).SetProjection(bson.M{fmt.Sprintf("extend_msgs.%s", clientMsgID): 1})
regex := fmt.Sprintf("^%s", sourceID)
result, err := e.ExtendMsgSetCollection.Find(ctx, bson.M{"source_id": primitive.Regex{Pattern: regex}, "session_type": sessionType, "max_msg_update_time": bson.M{"$lte": maxMsgUpdateTime}}, findOpts)

@ -56,25 +56,26 @@ func (m *Mongo) GetClient() *mongo.Client {
return m.db
}
func (m *Mongo) CreateMsgIndex() {
if err := m.createMongoIndex(unrelation.CChat, false, "uid"); err != nil {
fmt.Println(err.Error() + " index create failed " + unrelation.CChat + " uid, please create index by yourself in field uid")
}
func (m *Mongo) GetDatabase() *mongo.Database {
return m.db.Database(config.Config.Mongo.DBDatabase)
}
func (m *Mongo) CreateMsgIndex() error {
return m.createMongoIndex(unrelation.CChat, false, "uid")
}
func (m *Mongo) CreateSuperGroupIndex() {
func (m *Mongo) CreateSuperGroupIndex() error {
if err := m.createMongoIndex(unrelation.CSuperGroup, true, "group_id"); err != nil {
panic(err.Error() + "index create failed " + unrelation.CSuperGroup + " group_id")
return err
}
if err := m.createMongoIndex(unrelation.CUserToSuperGroup, true, "user_id"); err != nil {
panic(err.Error() + "index create failed " + unrelation.CUserToSuperGroup + "user_id")
return err
}
return nil
}
func (m *Mongo) CreateExtendMsgSetIndex() {
if err := m.createMongoIndex(unrelation.CExtendMsgSet, true, "-create_time", "work_moment_id"); err != nil {
panic(err.Error() + "index create failed " + unrelation.CExtendMsgSet + " -create_time, work_moment_id")
}
func (m *Mongo) CreateExtendMsgSetIndex() error {
return m.createMongoIndex(unrelation.CExtendMsgSet, true, "-create_time", "work_moment_id")
}
func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...string) error {
@ -107,26 +108,3 @@ func (m *Mongo) createMongoIndex(collection string, isUnique bool, keys ...strin
}
return nil
}
func MongoTransaction(ctx context.Context, mgo *mongo.Client, fn func(ctx mongo.SessionContext) error) error {
sess, err := mgo.StartSession()
if err != nil {
return err
}
sCtx := mongo.NewSessionContext(ctx, sess)
defer sess.EndSession(sCtx)
if err := fn(sCtx); err != nil {
_ = sess.AbortTransaction(sCtx)
return err
}
return utils.Wrap(sess.CommitTransaction(sCtx), "")
}
func getTxCtx(ctx context.Context, tx []any) context.Context {
if len(tx) > 0 {
if ctx, ok := tx[0].(mongo.SessionContext); ok {
return ctx
}
}
return ctx
}

@ -18,13 +18,12 @@ var ErrMsgListNotExist = errors.New("user not have msg in mongoDB")
var ErrMsgNotFound = errors.New("msg not found")
type MsgMongoDriver struct {
mgoDB *mongo.Database
MsgCollection *mongo.Collection
msg table.MsgDocModel
}
func NewMsgMongoDriver(mgoDB *mongo.Database) *MsgMongoDriver {
return &MsgMongoDriver{mgoDB: mgoDB, MsgCollection: mgoDB.Collection(table.MsgDocModel{}.TableName())}
func NewMsgMongoDriver(database *mongo.Database) table.MsgDocModelInterface {
return &MsgMongoDriver{MsgCollection: database.Collection(table.MsgDocModel{}.TableName())}
}
func (m *MsgMongoDriver) PushMsgsToDoc(ctx context.Context, docID string, msgsToMongo []table.MsgInfoModel) error {

@ -11,14 +11,11 @@ import (
"go.mongodb.org/mongo-driver/mongo/readconcern"
)
func NewSuperGroupMongoDriver(mgoClient *mongo.Client) unrelation.SuperGroupModelInterface {
mgoDB := mgoClient.Database(config.Config.Mongo.DBDatabase)
return &SuperGroupMongoDriver{MgoDB: mgoDB, MgoClient: mgoClient, superGroupCollection: mgoDB.Collection(unrelation.CSuperGroup), userToSuperGroupCollection: mgoDB.Collection(unrelation.CUserToSuperGroup)}
func NewSuperGroupMongoDriver(database *mongo.Database) unrelation.SuperGroupModelInterface {
return &SuperGroupMongoDriver{superGroupCollection: database.Collection(unrelation.CSuperGroup), userToSuperGroupCollection: database.Collection(unrelation.CUserToSuperGroup)}
}
type SuperGroupMongoDriver struct {
MgoClient *mongo.Client
MgoDB *mongo.Database
superGroupCollection *mongo.Collection
userToSuperGroupCollection *mongo.Collection
}

@ -7,6 +7,8 @@
package kafka
import (
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/tracelog"
"context"
"github.com/Shopify/sarama"
)
@ -39,6 +41,19 @@ func NewMConsumerGroup(consumerConfig *MConsumerGroupConfig, topics, addrs []str
topics,
}
}
func (mc *MConsumerGroup) GetContextFromMsg(cMsg *sarama.ConsumerMessage) context.Context {
ctx := context.Background()
var operationID string
for _, v := range cMsg.Headers {
if string(v.Key) == constant.OperationID {
operationID = string(v.Value)
}
}
tracelog.SetOperationID(ctx, operationID)
return ctx
}
func (mc *MConsumerGroup) RegisterHandleAndConsumer(handler sarama.ConsumerGroupHandler) {
ctx := context.Background()
for {

@ -2,6 +2,7 @@ package kafka
import (
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
log "OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
@ -67,6 +68,7 @@ func (p *Producer) SendMessage(ctx context.Context, m proto.Message, key string)
return -1, -1, errors.New("key or value == 0")
}
kMsg.Metadata = ctx
kMsg.Headers = []sarama.RecordHeader{{Key: []byte(constant.OperationID), Value: []byte(operationID)}}
partition, offset, err := p.producer.SendMessage(kMsg)
log.Info(operationID, "ByteEncoder SendMessage end", "key ", kMsg.Key.Length(), kMsg.Value.Length(), p.producer)
if err == nil {

@ -1,6 +1,7 @@
package middleware
import (
"OpenIM/pkg/common/constant"
"bytes"
"encoding/json"
"github.com/gin-gonic/gin"
@ -27,7 +28,7 @@ func CorsHandler() gin.HandlerFunc {
func GinParseOperationID(c *gin.Context) {
if c.Request.Method == http.MethodPost {
operationID := c.Request.Header.Get("operationID")
operationID := c.Request.Header.Get(constant.OperationID)
if operationID == "" {
body, err := ioutil.ReadAll(c.Request.Body)
if err != nil {
@ -50,9 +51,9 @@ func GinParseOperationID(c *gin.Context) {
}
c.Request.Body = ioutil.NopCloser(bytes.NewReader(body))
operationID = req.OperationID
c.Request.Header.Set("operationID", operationID)
c.Request.Header.Set(constant.OperationID, operationID)
}
c.Set("operationID", operationID)
c.Set(constant.OperationID, operationID)
c.Next()
return
}

@ -28,7 +28,7 @@ func RpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
if !ok {
return nil, status.New(codes.InvalidArgument, "missing metadata").Err()
}
if opts := md.Get("operationID"); len(opts) != 1 || opts[0] == "" {
if opts := md.Get(constant.OperationID); len(opts) != 1 || opts[0] == "" {
return nil, status.New(codes.InvalidArgument, "operationID error").Err()
} else {
operationID = opts[0]
@ -71,7 +71,7 @@ func RpcClientInterceptor(ctx context.Context, method string, req, reply interfa
//if cc == nil {
// return utils.Wrap(constant.ErrRpcConn, "")
//}
operationID, ok := ctx.Value("operationID").(string)
operationID, ok := ctx.Value(constant.OperationID).(string)
if !ok {
return utils.Wrap(constant.ErrArgs, "ctx missing operationID")
}
@ -79,6 +79,6 @@ func RpcClientInterceptor(ctx context.Context, method string, req, reply interfa
if !ok {
return utils.Wrap(constant.ErrArgs, "ctx missing opUserID")
}
md := metadata.Pairs("operationID", operationID, "opUserID", opUserID)
md := metadata.Pairs(constant.OperationID, operationID, "opUserID", opUserID)
return invoker(metadata.NewOutgoingContext(ctx, md), method, req, reply, cc, opts...)
}

@ -1,6 +1,7 @@
package tracelog
import (
"OpenIM/pkg/common/constant"
"OpenIM/pkg/utils"
"context"
"github.com/sirupsen/logrus"
@ -15,7 +16,7 @@ import (
const TraceLogKey = "tracelog"
func NewCtx(c *gin.Context, api string) context.Context {
req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: c.GetHeader("operationID"), Funcs: &[]FuncInfo{}}
req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: c.GetHeader(constant.OperationID), Funcs: &[]FuncInfo{}}
return context.WithValue(c, TraceLogKey, req)
}

@ -1,5 +1,4 @@
syntax = "proto3";
import "Open-IM-Server/pkg/proto/sdkws/ws.proto";
package pbAuth;
option go_package = "OpenIM/pkg/proto/auth;pbAuth";

@ -37,7 +37,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} }
func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) }
func (*MsgDataToMQ) ProtoMessage() {}
func (*MsgDataToMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{0}
return fileDescriptor_msg_fadfaac491b17a8b, []int{0}
}
func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b)
@ -82,7 +82,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} }
func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) }
func (*MsgDataToDB) ProtoMessage() {}
func (*MsgDataToDB) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{1}
return fileDescriptor_msg_fadfaac491b17a8b, []int{1}
}
func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b)
@ -121,7 +121,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} }
func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) }
func (*PushMsgDataToMQ) ProtoMessage() {}
func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{2}
return fileDescriptor_msg_fadfaac491b17a8b, []int{2}
}
func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b)
@ -169,7 +169,7 @@ func (m *MsgDataToMongoByMQ) Reset() { *m = MsgDataToMongoByMQ{} }
func (m *MsgDataToMongoByMQ) String() string { return proto.CompactTextString(m) }
func (*MsgDataToMongoByMQ) ProtoMessage() {}
func (*MsgDataToMongoByMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{3}
return fileDescriptor_msg_fadfaac491b17a8b, []int{3}
}
func (m *MsgDataToMongoByMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToMongoByMQ.Unmarshal(m, b)
@ -228,7 +228,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{4}
return fileDescriptor_msg_fadfaac491b17a8b, []int{4}
}
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
@ -267,7 +267,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{5}
return fileDescriptor_msg_fadfaac491b17a8b, []int{5}
}
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
@ -312,7 +312,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} }
func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
func (*SendMsgReq) ProtoMessage() {}
func (*SendMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{6}
return fileDescriptor_msg_fadfaac491b17a8b, []int{6}
}
func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
@ -352,7 +352,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} }
func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
func (*SendMsgResp) ProtoMessage() {}
func (*SendMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{7}
return fileDescriptor_msg_fadfaac491b17a8b, []int{7}
}
func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
@ -404,7 +404,7 @@ func (m *ClearMsgReq) Reset() { *m = ClearMsgReq{} }
func (m *ClearMsgReq) String() string { return proto.CompactTextString(m) }
func (*ClearMsgReq) ProtoMessage() {}
func (*ClearMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{8}
return fileDescriptor_msg_fadfaac491b17a8b, []int{8}
}
func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b)
@ -441,7 +441,7 @@ func (m *ClearMsgResp) Reset() { *m = ClearMsgResp{} }
func (m *ClearMsgResp) String() string { return proto.CompactTextString(m) }
func (*ClearMsgResp) ProtoMessage() {}
func (*ClearMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{9}
return fileDescriptor_msg_fadfaac491b17a8b, []int{9}
}
func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b)
@ -474,7 +474,7 @@ func (m *SetMsgMinSeqReq) Reset() { *m = SetMsgMinSeqReq{} }
func (m *SetMsgMinSeqReq) String() string { return proto.CompactTextString(m) }
func (*SetMsgMinSeqReq) ProtoMessage() {}
func (*SetMsgMinSeqReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{10}
return fileDescriptor_msg_fadfaac491b17a8b, []int{10}
}
func (m *SetMsgMinSeqReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetMsgMinSeqReq.Unmarshal(m, b)
@ -525,7 +525,7 @@ func (m *SetMsgMinSeqResp) Reset() { *m = SetMsgMinSeqResp{} }
func (m *SetMsgMinSeqResp) String() string { return proto.CompactTextString(m) }
func (*SetMsgMinSeqResp) ProtoMessage() {}
func (*SetMsgMinSeqResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{11}
return fileDescriptor_msg_fadfaac491b17a8b, []int{11}
}
func (m *SetMsgMinSeqResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetMsgMinSeqResp.Unmarshal(m, b)
@ -556,7 +556,7 @@ func (m *SetSendMsgStatusReq) Reset() { *m = SetSendMsgStatusReq{} }
func (m *SetSendMsgStatusReq) String() string { return proto.CompactTextString(m) }
func (*SetSendMsgStatusReq) ProtoMessage() {}
func (*SetSendMsgStatusReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{12}
return fileDescriptor_msg_fadfaac491b17a8b, []int{12}
}
func (m *SetSendMsgStatusReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetSendMsgStatusReq.Unmarshal(m, b)
@ -593,7 +593,7 @@ func (m *SetSendMsgStatusResp) Reset() { *m = SetSendMsgStatusResp{} }
func (m *SetSendMsgStatusResp) String() string { return proto.CompactTextString(m) }
func (*SetSendMsgStatusResp) ProtoMessage() {}
func (*SetSendMsgStatusResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{13}
return fileDescriptor_msg_fadfaac491b17a8b, []int{13}
}
func (m *SetSendMsgStatusResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetSendMsgStatusResp.Unmarshal(m, b)
@ -623,7 +623,7 @@ func (m *GetSendMsgStatusReq) Reset() { *m = GetSendMsgStatusReq{} }
func (m *GetSendMsgStatusReq) String() string { return proto.CompactTextString(m) }
func (*GetSendMsgStatusReq) ProtoMessage() {}
func (*GetSendMsgStatusReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{14}
return fileDescriptor_msg_fadfaac491b17a8b, []int{14}
}
func (m *GetSendMsgStatusReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSendMsgStatusReq.Unmarshal(m, b)
@ -654,7 +654,7 @@ func (m *GetSendMsgStatusResp) Reset() { *m = GetSendMsgStatusResp{} }
func (m *GetSendMsgStatusResp) String() string { return proto.CompactTextString(m) }
func (*GetSendMsgStatusResp) ProtoMessage() {}
func (*GetSendMsgStatusResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{15}
return fileDescriptor_msg_fadfaac491b17a8b, []int{15}
}
func (m *GetSendMsgStatusResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSendMsgStatusResp.Unmarshal(m, b)
@ -693,7 +693,7 @@ func (m *DelSuperGroupMsgReq) Reset() { *m = DelSuperGroupMsgReq{} }
func (m *DelSuperGroupMsgReq) String() string { return proto.CompactTextString(m) }
func (*DelSuperGroupMsgReq) ProtoMessage() {}
func (*DelSuperGroupMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{16}
return fileDescriptor_msg_fadfaac491b17a8b, []int{16}
}
func (m *DelSuperGroupMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DelSuperGroupMsgReq.Unmarshal(m, b)
@ -737,7 +737,7 @@ func (m *DelSuperGroupMsgResp) Reset() { *m = DelSuperGroupMsgResp{} }
func (m *DelSuperGroupMsgResp) String() string { return proto.CompactTextString(m) }
func (*DelSuperGroupMsgResp) ProtoMessage() {}
func (*DelSuperGroupMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{17}
return fileDescriptor_msg_fadfaac491b17a8b, []int{17}
}
func (m *DelSuperGroupMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DelSuperGroupMsgResp.Unmarshal(m, b)
@ -769,7 +769,7 @@ func (m *GetSuperGroupMsgReq) Reset() { *m = GetSuperGroupMsgReq{} }
func (m *GetSuperGroupMsgReq) String() string { return proto.CompactTextString(m) }
func (*GetSuperGroupMsgReq) ProtoMessage() {}
func (*GetSuperGroupMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{18}
return fileDescriptor_msg_fadfaac491b17a8b, []int{18}
}
func (m *GetSuperGroupMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSuperGroupMsgReq.Unmarshal(m, b)
@ -814,7 +814,7 @@ func (m *GetSuperGroupMsgResp) Reset() { *m = GetSuperGroupMsgResp{} }
func (m *GetSuperGroupMsgResp) String() string { return proto.CompactTextString(m) }
func (*GetSuperGroupMsgResp) ProtoMessage() {}
func (*GetSuperGroupMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{19}
return fileDescriptor_msg_fadfaac491b17a8b, []int{19}
}
func (m *GetSuperGroupMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSuperGroupMsgResp.Unmarshal(m, b)
@ -852,7 +852,7 @@ func (m *GetWriteDiffMsgReq) Reset() { *m = GetWriteDiffMsgReq{} }
func (m *GetWriteDiffMsgReq) String() string { return proto.CompactTextString(m) }
func (*GetWriteDiffMsgReq) ProtoMessage() {}
func (*GetWriteDiffMsgReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{20}
return fileDescriptor_msg_fadfaac491b17a8b, []int{20}
}
func (m *GetWriteDiffMsgReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetWriteDiffMsgReq.Unmarshal(m, b)
@ -890,7 +890,7 @@ func (m *GetWriteDiffMsgResp) Reset() { *m = GetWriteDiffMsgResp{} }
func (m *GetWriteDiffMsgResp) String() string { return proto.CompactTextString(m) }
func (*GetWriteDiffMsgResp) ProtoMessage() {}
func (*GetWriteDiffMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{21}
return fileDescriptor_msg_fadfaac491b17a8b, []int{21}
}
func (m *GetWriteDiffMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetWriteDiffMsgResp.Unmarshal(m, b)
@ -936,7 +936,7 @@ func (m *ModifyMessageReactionExtensionsReq) Reset() { *m = ModifyMessag
func (m *ModifyMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
func (*ModifyMessageReactionExtensionsReq) ProtoMessage() {}
func (*ModifyMessageReactionExtensionsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{22}
return fileDescriptor_msg_fadfaac491b17a8b, []int{22}
}
func (m *ModifyMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ModifyMessageReactionExtensionsReq.Unmarshal(m, b)
@ -1038,7 +1038,7 @@ func (m *SetMessageReactionExtensionsReq) Reset() { *m = SetMessageReact
func (m *SetMessageReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
func (*SetMessageReactionExtensionsReq) ProtoMessage() {}
func (*SetMessageReactionExtensionsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{23}
return fileDescriptor_msg_fadfaac491b17a8b, []int{23}
}
func (m *SetMessageReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetMessageReactionExtensionsReq.Unmarshal(m, b)
@ -1135,7 +1135,7 @@ func (m *SetMessageReactionExtensionsResp) Reset() { *m = SetMessageReac
func (m *SetMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
func (*SetMessageReactionExtensionsResp) ProtoMessage() {}
func (*SetMessageReactionExtensionsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{24}
return fileDescriptor_msg_fadfaac491b17a8b, []int{24}
}
func (m *SetMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetMessageReactionExtensionsResp.Unmarshal(m, b)
@ -1197,7 +1197,7 @@ func (m *GetMessagesReactionExtensionsReq) Reset() { *m = GetMessagesRea
func (m *GetMessagesReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
func (*GetMessagesReactionExtensionsReq) ProtoMessage() {}
func (*GetMessagesReactionExtensionsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{25}
return fileDescriptor_msg_fadfaac491b17a8b, []int{25}
}
func (m *GetMessagesReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMessagesReactionExtensionsReq.Unmarshal(m, b)
@ -1261,7 +1261,7 @@ func (m *GetMessagesReactionExtensionsReq_MessageReactionKey) String() string {
}
func (*GetMessagesReactionExtensionsReq_MessageReactionKey) ProtoMessage() {}
func (*GetMessagesReactionExtensionsReq_MessageReactionKey) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{25, 0}
return fileDescriptor_msg_fadfaac491b17a8b, []int{25, 0}
}
func (m *GetMessagesReactionExtensionsReq_MessageReactionKey) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMessagesReactionExtensionsReq_MessageReactionKey.Unmarshal(m, b)
@ -1306,7 +1306,7 @@ func (m *GetMessagesReactionExtensionsResp) Reset() { *m = GetMessagesRe
func (m *GetMessagesReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
func (*GetMessagesReactionExtensionsResp) ProtoMessage() {}
func (*GetMessagesReactionExtensionsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{26}
return fileDescriptor_msg_fadfaac491b17a8b, []int{26}
}
func (m *GetMessagesReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetMessagesReactionExtensionsResp.Unmarshal(m, b)
@ -1345,7 +1345,7 @@ func (m *SingleMessageExtensionResult) Reset() { *m = SingleMessageExten
func (m *SingleMessageExtensionResult) String() string { return proto.CompactTextString(m) }
func (*SingleMessageExtensionResult) ProtoMessage() {}
func (*SingleMessageExtensionResult) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{27}
return fileDescriptor_msg_fadfaac491b17a8b, []int{27}
}
func (m *SingleMessageExtensionResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SingleMessageExtensionResult.Unmarshal(m, b)
@ -1391,7 +1391,7 @@ func (m *ModifyMessageReactionExtensionsResp) Reset() { *m = ModifyMessa
func (m *ModifyMessageReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
func (*ModifyMessageReactionExtensionsResp) ProtoMessage() {}
func (*ModifyMessageReactionExtensionsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{28}
return fileDescriptor_msg_fadfaac491b17a8b, []int{28}
}
func (m *ModifyMessageReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ModifyMessageReactionExtensionsResp.Unmarshal(m, b)
@ -1443,7 +1443,7 @@ func (m *DeleteMessagesReactionExtensionsReq) Reset() { *m = DeleteMessa
func (m *DeleteMessagesReactionExtensionsReq) String() string { return proto.CompactTextString(m) }
func (*DeleteMessagesReactionExtensionsReq) ProtoMessage() {}
func (*DeleteMessagesReactionExtensionsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{29}
return fileDescriptor_msg_fadfaac491b17a8b, []int{29}
}
func (m *DeleteMessagesReactionExtensionsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteMessagesReactionExtensionsReq.Unmarshal(m, b)
@ -1530,7 +1530,7 @@ func (m *DeleteMessagesReactionExtensionsResp) Reset() { *m = DeleteMess
func (m *DeleteMessagesReactionExtensionsResp) String() string { return proto.CompactTextString(m) }
func (*DeleteMessagesReactionExtensionsResp) ProtoMessage() {}
func (*DeleteMessagesReactionExtensionsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{30}
return fileDescriptor_msg_fadfaac491b17a8b, []int{30}
}
func (m *DeleteMessagesReactionExtensionsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteMessagesReactionExtensionsResp.Unmarshal(m, b)
@ -1568,7 +1568,7 @@ func (m *ExtendMsgResp) Reset() { *m = ExtendMsgResp{} }
func (m *ExtendMsgResp) String() string { return proto.CompactTextString(m) }
func (*ExtendMsgResp) ProtoMessage() {}
func (*ExtendMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{31}
return fileDescriptor_msg_fadfaac491b17a8b, []int{31}
}
func (m *ExtendMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExtendMsgResp.Unmarshal(m, b)
@ -1610,7 +1610,7 @@ func (m *ExtendMsg) Reset() { *m = ExtendMsg{} }
func (m *ExtendMsg) String() string { return proto.CompactTextString(m) }
func (*ExtendMsg) ProtoMessage() {}
func (*ExtendMsg) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{32}
return fileDescriptor_msg_fadfaac491b17a8b, []int{32}
}
func (m *ExtendMsg) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExtendMsg.Unmarshal(m, b)
@ -1667,6 +1667,8 @@ func (m *ExtendMsg) GetEx() string {
type KeyValueResp struct {
KeyValue *sdkws.KeyValue `protobuf:"bytes,1,opt,name=keyValue" json:"keyValue,omitempty"`
ErrCode int32 `protobuf:"varint,2,opt,name=errCode" json:"errCode,omitempty"`
ErrMsg string `protobuf:"bytes,3,opt,name=errMsg" json:"errMsg,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -1676,7 +1678,7 @@ func (m *KeyValueResp) Reset() { *m = KeyValueResp{} }
func (m *KeyValueResp) String() string { return proto.CompactTextString(m) }
func (*KeyValueResp) ProtoMessage() {}
func (*KeyValueResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{33}
return fileDescriptor_msg_fadfaac491b17a8b, []int{33}
}
func (m *KeyValueResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_KeyValueResp.Unmarshal(m, b)
@ -1703,9 +1705,24 @@ func (m *KeyValueResp) GetKeyValue() *sdkws.KeyValue {
return nil
}
func (m *KeyValueResp) GetErrCode() int32 {
if m != nil {
return m.ErrCode
}
return 0
}
func (m *KeyValueResp) GetErrMsg() string {
if m != nil {
return m.ErrMsg
}
return ""
}
type MsgDataToModifyByMQ struct {
Messages []*MsgDataToMQ `protobuf:"bytes,1,rep,name=messages" json:"messages,omitempty"`
TriggerID string `protobuf:"bytes,2,opt,name=triggerID" json:"triggerID,omitempty"`
AggregationID string `protobuf:"bytes,3,opt,name=aggregationID" json:"aggregationID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -1715,7 +1732,7 @@ func (m *MsgDataToModifyByMQ) Reset() { *m = MsgDataToModifyByMQ{} }
func (m *MsgDataToModifyByMQ) String() string { return proto.CompactTextString(m) }
func (*MsgDataToModifyByMQ) ProtoMessage() {}
func (*MsgDataToModifyByMQ) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{34}
return fileDescriptor_msg_fadfaac491b17a8b, []int{34}
}
func (m *MsgDataToModifyByMQ) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MsgDataToModifyByMQ.Unmarshal(m, b)
@ -1749,6 +1766,13 @@ func (m *MsgDataToModifyByMQ) GetTriggerID() string {
return ""
}
func (m *MsgDataToModifyByMQ) GetAggregationID() string {
if m != nil {
return m.AggregationID
}
return ""
}
type DelMsgsReq struct {
UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"`
Seqs []int64 `protobuf:"varint,3,rep,packed,name=seqs" json:"seqs,omitempty"`
@ -1761,7 +1785,7 @@ func (m *DelMsgsReq) Reset() { *m = DelMsgsReq{} }
func (m *DelMsgsReq) String() string { return proto.CompactTextString(m) }
func (*DelMsgsReq) ProtoMessage() {}
func (*DelMsgsReq) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{35}
return fileDescriptor_msg_fadfaac491b17a8b, []int{35}
}
func (m *DelMsgsReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DelMsgsReq.Unmarshal(m, b)
@ -1805,7 +1829,7 @@ func (m *DelMsgsResp) Reset() { *m = DelMsgsResp{} }
func (m *DelMsgsResp) String() string { return proto.CompactTextString(m) }
func (*DelMsgsResp) ProtoMessage() {}
func (*DelMsgsResp) Descriptor() ([]byte, []int) {
return fileDescriptor_msg_ac49bd168f1c55a0, []int{36}
return fileDescriptor_msg_fadfaac491b17a8b, []int{36}
}
func (m *DelMsgsResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DelMsgsResp.Unmarshal(m, b)
@ -2323,100 +2347,102 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
Metadata: "msg/msg.proto",
}
func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_ac49bd168f1c55a0) }
var fileDescriptor_msg_ac49bd168f1c55a0 = []byte{
// 1466 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xdd, 0x72, 0xdb, 0xc4,
0x17, 0x1f, 0xd9, 0x4e, 0x62, 0x1f, 0x37, 0x4d, 0xba, 0xc9, 0xbf, 0x7f, 0x57, 0x84, 0xa9, 0xab,
0x36, 0xad, 0x3b, 0x24, 0xce, 0x4c, 0x60, 0xa0, 0x50, 0x98, 0xb6, 0xc1, 0xc5, 0x64, 0x8a, 0x68,
0x2b, 0x97, 0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,
0x9c, 0xe7, 0x02, 0xa9, 0x39, 0xef, 0x65, 0x80, 0x0b, 0xea, 0xe6, 0x0b, 0xea, 0x16, 0x0a, 0xca,
0x7d, 0x33, 0x38, 0x86, 0xad, 0x59, 0xa7, 0x4a, 0x72, 0x63, 0x91, 0x0b, 0x83, 0xba, 0xbd, 0x00,
0x0a, 0x19, 0x71, 0xe1, 0xdd, 0x99, 0x87, 0x16, 0xb2, 0xbd, 0xd0, 0x41, 0x4d, 0xbd, 0xb9, 0x08,
0x0c, 0x19, 0x39, 0x81, 0xad, 0x07, 0xfd, 0x7e, 0xb1, 0x73, 0xb7, 0x16, 0xbc, 0x48, 0xab, 0xad,
0xc5, 0x80, 0xc8, 0xc8, 0x6b, 0xb8, 0x9a, 0xfa, 0x35, 0xe4, 0x68, 0x6d, 0x45, 0x05, 0x35, 0xef,
0x57, 0xad, 0xde, 0x5e, 0x10, 0x89, 0xec, 0x40, 0xfd, 0xae, 0xf1, 0x98, 0x51, 0xf7, 0x50, 0x4f,
0x3c, 0xf1, 0x0e, 0xd1, 0xba, 0x3b, 0x44, 0xeb, 0xe5, 0xb2, 0x20, 0xdf, 0xff, 0x3b, 0x00, 0x00,
0xff, 0xff, 0x17, 0x99, 0x70, 0x0d, 0x4a, 0x16, 0x00, 0x00,
func init() { proto.RegisterFile("msg/msg.proto", fileDescriptor_msg_fadfaac491b17a8b) }
var fileDescriptor_msg_fadfaac491b17a8b = []byte{
// 1497 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xdd, 0x72, 0xdb, 0x44,
0x14, 0x1e, 0xd9, 0xf9, 0xf3, 0x71, 0xd3, 0xa4, 0x9b, 0x50, 0x5c, 0x11, 0xa6, 0xee, 0xb6, 0x69,
0xd3, 0x21, 0x71, 0x66, 0x02, 0x03, 0xe5, 0x6f, 0xda, 0xa6, 0x2e, 0x26, 0x53, 0x44, 0x5b, 0xb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0xa4, 0x03, 0xab, 0xe3, 0xef, 0x63, 0xd2, 0x88,
0x51, 0xe3, 0xcf, 0x63, 0xfd, 0x52, 0xc9, 0x0e, 0x72, 0xb2, 0x0b, 0x4b, 0xf1, 0x00, 0x83, 0x44,
0x6a, 0x52, 0x63, 0x0f, 0xfd, 0xc2, 0xd8, 0x4a, 0xa4, 0x79, 0x7c, 0x82, 0xa0, 0x34, 0x17, 0xcc,
0x21, 0x94, 0xe6, 0xa2, 0x91, 0x83, 0x10, 0xd4, 0x29, 0x16, 0xd4, 0x29, 0x15, 0x54, 0x38, 0x8c,
0x38, 0x86, 0x8d, 0x49, 0xd7, 0x55, 0x72, 0x6d, 0x96, 0x97, 0x88, 0xbe, 0x39, 0x03, 0x0a, 0x39,
0xf1, 0xe0, 0xdd, 0x89, 0xb7, 0x21, 0xb2, 0x39, 0xd3, 0x0d, 0x50, 0xbf, 0x3e, 0x0b, 0x0c, 0x39,
0x39, 0x81, 0x8d, 0xbb, 0xbd, 0x5e, 0xf9, 0xe1, 0x6e, 0xcc, 0xf8, 0x42, 0xd7, 0xb7, 0x66, 0x03,
0x22, 0x27, 0x2f, 0xe1, 0x72, 0xe6, 0x9f, 0x53, 0xa0, 0x75, 0x2b, 0x4e, 0xa8, 0x69, 0x77, 0x00,
0xfd, 0xe6, 0x8c, 0x48, 0xe4, 0xfb, 0xfa, 0x77, 0x8d, 0x87, 0x9c, 0x79, 0x07, 0x46, 0x6a, 0x76,
0xdc, 0x47, 0xfb, 0xd3, 0x3e, 0xda, 0xcf, 0x17, 0x24, 0xf9, 0xfe, 0x3f, 0x01, 0x00, 0x00, 0xff,
0xff, 0x8e, 0xd0, 0xc6, 0xc7, 0xa3, 0x16, 0x00, 0x00,
}

@ -182,11 +182,14 @@ message ExtendMsg {
message KeyValueResp {
sdkws.KeyValue keyValue = 1;
int32 errCode = 2;
string errMsg = 3;
}
message MsgDataToModifyByMQ{
repeated MsgDataToMQ messages = 1;
string triggerID = 2;
string aggregationID = 3;
}
message DelMsgsReq{

@ -42,13 +42,13 @@ else
fi
#check=$(ps aux | grep -w ./${cron_task_name} | grep -v grep | wc -l)
#if [ $check -ge 1 ]; then
# echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImCronTask"${COLOR_SUFFIX}
#else
# echo -e ${RED_PREFIX}"cron_task_name service does not start normally"${COLOR_SUFFIX}
# echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
# exit -1
#fi
#
#echo -e ${YELLOW_PREFIX}"all services launch success"${COLOR_SUFFIX}
check=$(ps aux | grep -w ./${cron_task_name} | grep -v grep | wc -l)
if [ $check -ge 1 ]; then
echo -e ${GREEN_PREFIX}"none port has been listening,belongs service is openImCronTask"${COLOR_SUFFIX}
else
echo -e ${RED_PREFIX}"cron_task_name service does not start normally"${COLOR_SUFFIX}
echo -e ${RED_PREFIX}"please check ../logs/openIM.log "${COLOR_SUFFIX}
exit -1
fi
echo -e ${YELLOW_PREFIX}"all services launch success"${COLOR_SUFFIX}

Loading…
Cancel
Save