Add retry mechanism to mongoDB, Redis, Kafka

pull/518/head
plutoyty 1 year ago
parent 40b26f9a2f
commit d41f2a7aef

@ -56,11 +56,14 @@ kafka:
topic: "offlineMsgToMongoMysql" #不建议修改 topic: "offlineMsgToMongoMysql" #不建议修改
msgToPush: msgToPush:
topic: "msgToPush" #不建议修改 topic: "msgToPush" #不建议修改
msgToModify:
topic: "msgToModify" #不建议修改
consumerGroupID: #消费者组,不建议修改 consumerGroupID: #消费者组,不建议修改
msgToRedis: redis # msgToRedis: redis #
msgToMongo: mongo # msgToMongo: mongo #
msgToMySql: mysql # msgToMySql: mysql #
msgToPush: push # msgToPush: push #
msgToModify: modify #
rpc: rpc:
@ -73,26 +76,41 @@ api:
listenIP: #默认为0.0.0.0 listenIP: #默认为0.0.0.0
object: object:
enable: "minio" #使用minio enable: minio #使用minio
apiURL: "http://127.0.0.1:10002/object/" apiURL: http://127.0.0.1:10002/third/object
minio: minio:
bucket: "openim" #不建议修改 tempBucket: "openim" #不建议修改
endpoint: "http://127.0.0.1:10005" #minio对外服务的ip和端口app要能访问此ip和端口 dataBucket: "openim" #不建议修改
accessKeyID: "root" #ID location: us-east-1 #不建议修改
secretAccessKey: "openIM123" #秘钥 endpoint: http://127.0.0.1:10005 #minio对外服务的ip和端口app要能访问此ip和端口
sessionToken: "" #token accessKeyID: root #ID
cos: #tencent cos secretAccessKey: openIM123 #秘钥
bucketURL: "https://temp-1252357374.cos.ap-chengdu.myqcloud.com" isDistributedMod: false #是否分布式多硬盘部署如果是多硬盘部署需要修改为true
secretID: "" tencent: #tencent cos
secretKey: "" appID:
sessionToken: "" region:
oss: #ali oss bucket:
endpoint: "https://oss-cn-chengdu.aliyuncs.com" secretID:
bucket: "demo-9999999" secretKey:
bucketURL: "https://demo-9999999.oss-cn-chengdu.aliyuncs.com" ali: #ali oss
accessKeyID: "" regionID:
accessKeySecret: "" accessKeyID:
sessionToken: "" accessKeySecret:
stsEndpoint:
ossEndpoint:
bucket:
finalHost:
stsDurationSeconds:
OssRoleArn:
aws:
accessKeyID:
accessKeySecret:
region:
bucket:
finalHost:
roleArn:
externalId:
roleSessionName:
rpcPort: #rpc服务端口不建议修改端口由脚本读取后传入程序如启动多个程序只需要填入多个端口用逗号隔开如 [10110, 10111] rpcPort: #rpc服务端口不建议修改端口由脚本读取后传入程序如启动多个程序只需要填入多个端口用逗号隔开如 [10110, 10111]
openImUserPort: [ 10110 ] openImUserPort: [ 10110 ]
@ -164,8 +182,7 @@ groupMessageHasReadReceiptEnable: true #群聊已读是否开
singleMessageHasReadReceiptEnable: true #单聊已读是否开启 singleMessageHasReadReceiptEnable: true #单聊已读是否开启
retainChatRecords: 365 #mongo保存离线消息时间 retainChatRecords: 365 #mongo保存离线消息时间
chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期超过retainChatRecords时间消息这个删除是为了清理满足上个配置retainChatRecords的过期消息不会发送通知仅仅作为清理磁盘使用 chatRecordsClearTime: "0 2 * * 3" #每周三凌晨2点清理mongo中的过期超过retainChatRecords时间消息
msgDestructTime: "0 2 * * *" #消息自动删除时间每天凌晨2点删除过期消息这个删除是为了删除保留时间超过超过会话字段msg_destruct_time的消息。
secret: tuoyun #秘钥获取token时校验 secret: tuoyun #秘钥获取token时校验

@ -27,4 +27,10 @@ func TestNewRedis(t *testing.T) {
fmt.Println("config load error") fmt.Println("config load error")
return return
} }
redis, err := NewRedis()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(redis)
} }

@ -76,6 +76,9 @@ func NewKafkaProducer(addr []string, topic string) *Producer {
//} //}
time.Sleep(time.Duration(1) * time.Second) time.Sleep(time.Duration(1) * time.Second)
} }
if err != nil {
panic(err.Error())
}
p.producer = producer p.producer = producer
return &p return &p
} }

Loading…
Cancel
Save