Package io.grpc
Class ClientInterceptors
java.lang.Object
io.grpc.ClientInterceptors
Utility methods for working with
ClientInterceptor
s.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
AForwardingClientCall
that delivers exceptions from its start logic to the call listener. -
Method Summary
Modifier and TypeMethodDescriptionstatic Channel
intercept
(Channel channel, ClientInterceptor... interceptors) Create a newChannel
that will callinterceptors
before starting a call on the given channel.static Channel
intercept
(Channel channel, List<? extends ClientInterceptor> interceptors) Create a newChannel
that will callinterceptors
before starting a call on the given channel.static Channel
interceptForward
(Channel channel, ClientInterceptor... interceptors) Create a newChannel
that will callinterceptors
before starting a call on the given channel.static Channel
interceptForward
(Channel channel, List<? extends ClientInterceptor> interceptors) Create a newChannel
that will callinterceptors
before starting a call on the given channel.
-
Method Details
-
interceptForward
Create a newChannel
that will callinterceptors
before starting a call on the given channel. The first interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)
called first.- Parameters:
channel
- the underlying channel to intercept.interceptors
- array of interceptors to bind tochannel
.- Returns:
- a new channel instance with the interceptors applied.
-
interceptForward
public static Channel interceptForward(Channel channel, List<? extends ClientInterceptor> interceptors) Create a newChannel
that will callinterceptors
before starting a call on the given channel. The first interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)
called first.- Parameters:
channel
- the underlying channel to intercept.interceptors
- a list of interceptors to bind tochannel
.- Returns:
- a new channel instance with the interceptors applied.
-
intercept
Create a newChannel
that will callinterceptors
before starting a call on the given channel. The last interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)
called first.- Parameters:
channel
- the underlying channel to intercept.interceptors
- array of interceptors to bind tochannel
.- Returns:
- a new channel instance with the interceptors applied.
-
intercept
Create a newChannel
that will callinterceptors
before starting a call on the given channel. The last interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)
called first.- Parameters:
channel
- the underlying channel to intercept.interceptors
- a list of interceptors to bind tochannel
.- Returns:
- a new channel instance with the interceptors applied.
-