@@ -93,6 +93,9 @@ type Options struct {
93
93
// Default == GrpcError2DtmError: Code Aborted => ErrFailure; Code FailedPrecondition => ErrOngoing
94
94
GRPCError2DtmError func (error ) error
95
95
96
+ // Default == KitexError2DtmError: Code Aborted | Code Internal => ErrFailure; Code FailedPrecondition => ErrOngoing
97
+ KITEXError2DtmError func (error ) error
98
+
96
99
// This Option specify whether a branch returning ErrFailure should be compensated on rollback.
97
100
// for most idempotent branches, no compensation is needed.
98
101
// But for a timeout request, the caller cannot know where the request is successful, so the compensation should be called
@@ -264,7 +267,7 @@ func Interceptor(ctx context.Context, method string, req, reply interface{}, cc
264
267
return wf .stepResultToGrpc (sr , reply )
265
268
}
266
269
267
- // KitexInterceptor is the middleware for workflow to capture grpc call result
270
+ // KitexInterceptor is the middleware for workflow to capture kitex grpc call result
268
271
func KitexInterceptor (next endpoint.Endpoint ) endpoint.Endpoint {
269
272
return func (ctx context.Context , req , resp interface {}) (err error ) {
270
273
ri := rpcinfo .GetRPCInfo (ctx )
@@ -278,7 +281,7 @@ func KitexInterceptor(next endpoint.Endpoint) endpoint.Endpoint {
278
281
origin := func () error {
279
282
ctx1 := dtmgimp .TransInfo2Ctx (ctx , wf .Gid , wf .TransType , wf .currentBranch , wf .currentOp , wf .Dtm )
280
283
err := next (ctx1 , req , resp )
281
- res := fmt .Sprintf ("grpc client called: %s%s %s result: %s err: %v" ,
284
+ res := fmt .Sprintf ("Kitex client called: %s%s %s result: %s err: %v" ,
282
285
ri .To ().ServiceName (), ri .To ().Method (), dtmimp .MustMarshalString (req ), dtmimp .MustMarshalString (resp ), err )
283
286
if err != nil {
284
287
logger .Errorf ("%s" , res )
@@ -292,9 +295,9 @@ func KitexInterceptor(next endpoint.Endpoint) endpoint.Endpoint {
292
295
}
293
296
sr := wf .recordedDo (func (bb * dtmcli.BranchBarrier ) * stepResult {
294
297
err := origin ()
295
- return wf .stepResultFromGrpc (resp , err )
298
+ return wf .stepResultFromKitex (resp , err )
296
299
})
297
- return wf .stepResultToGrpc (sr , resp )
300
+ return wf .stepResultToKitex (sr , resp )
298
301
}
299
302
300
303
}
0 commit comments