Skip to content

Commit

Permalink
doc: update client interceptors chaining example with grpc functions
Browse files Browse the repository at this point in the history
Replace middleware.ChainXXXClient(...) functions with
grpc.WithChainXXXInterceptor(...).

Also fix the number of parenthesis in the server interceptors chaining
example.
  • Loading branch information
dethi committed Oct 26, 2023
1 parent 71d7422 commit c01ad04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Simple way of turning a multiple interceptors into a single interceptor. Here's
server chaining:
myServer := grpc.NewServer(
grpc.ChainStreamInterceptor(loggingStream, monitoringStream, authStream)),
grpc.ChainStreamInterceptor(loggingStream, monitoringStream, authStream),
grpc.ChainUnaryInterceptor(loggingUnary, monitoringUnary, authUnary),
)
Expand All @@ -31,8 +31,8 @@ Here's an example for client side chaining:
clientConn, err = grpc.Dial(
address,
grpc.WithUnaryInterceptor(middleware.ChainUnaryClient(monitoringClientUnary, retryUnary)),
grpc.WithStreamInterceptor(middleware.ChainStreamClient(monitoringClientStream, retryStream)),
grpc.WithChainUnaryInterceptor(monitoringClientUnary, retryUnary),
grpc.WithChainStreamInterceptor(monitoringClientStream, retryStream),
)
client = testpb.NewTestServiceClient(clientConn)
resp, err := client.PingEmpty(s.ctx, &myservice.Request{Msg: "hello"})
Expand Down

0 comments on commit c01ad04

Please sign in to comment.