Package io.grpc
Class ClientInterceptors
java.lang.Object
io.grpc.ClientInterceptors
Utility methods for working with
ClientInterceptors.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAForwardingClientCallthat delivers exceptions from its start logic to the call listener.private static class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Channelintercept(Channel channel, ClientInterceptor... interceptors) Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.static Channelintercept(Channel channel, List<? extends ClientInterceptor> interceptors) Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.static ChannelinterceptForward(Channel channel, ClientInterceptor... interceptors) Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.static ChannelinterceptForward(Channel channel, List<? extends ClientInterceptor> interceptors) Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.(package private) static <WReqT,WRespT>
ClientInterceptorwrapClientInterceptor(ClientInterceptor interceptor, MethodDescriptor.Marshaller<WReqT> reqMarshaller, MethodDescriptor.Marshaller<WRespT> respMarshaller) Creates a new ClientInterceptor that transforms requests intoWReqTand responses intoWRespTbefore passing them into theinterceptor.
-
Field Details
-
NOOP_CALL
-
-
Constructor Details
-
ClientInterceptors
private ClientInterceptors()
-
-
Method Details
-
interceptForward
Create a newChannelthat will callinterceptorsbefore 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 newChannelthat will callinterceptorsbefore 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 newChannelthat will callinterceptorsbefore 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 newChannelthat will callinterceptorsbefore 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.
-
wrapClientInterceptor
static <WReqT,WRespT> ClientInterceptor wrapClientInterceptor(ClientInterceptor interceptor, MethodDescriptor.Marshaller<WReqT> reqMarshaller, MethodDescriptor.Marshaller<WRespT> respMarshaller) Creates a new ClientInterceptor that transforms requests intoWReqTand responses intoWRespTbefore passing them into theinterceptor.
-