msg update

This commit is contained in:
Gordon
2023-03-21 12:28:21 +08:00
parent 7eb28e7d0a
commit c036d27b36
40 changed files with 215 additions and 188 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ package kafka
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tracelog"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
"github.com/Shopify/sarama"
)
@@ -43,14 +43,14 @@ func NewMConsumerGroup(consumerConfig *MConsumerGroupConfig, topics, addrs []str
}
func (mc *MConsumerGroup) GetContextFromMsg(cMsg *sarama.ConsumerMessage, rootFuncName string) context.Context {
ctx := tracelog.NewCtx(rootFuncName)
ctx := mcontext.NewCtx(rootFuncName)
var operationID string
for _, v := range cMsg.Headers {
if string(v.Key) == constant.OperationID {
operationID = string(v.Value)
}
}
tracelog.SetOperationID(ctx, operationID)
mcontext.SetOperationID(ctx, operationID)
return ctx
}