Class CompositeGrpcChannelFactory
java.lang.Object
org.springframework.grpc.client.CompositeGrpcChannelFactory
- All Implemented Interfaces:
GrpcChannelFactory
A composite
GrpcChannelFactory that combines a list of channel factories.
The composite delegates channel creation to the first composed factory that supports the given target string.
- Author:
- Chris Bono
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeGrpcChannelFactory(List<GrpcChannelFactory> channelFactories) Creates a new CompositeGrpcChannelFactory with the given factories. -
Method Summary
Modifier and TypeMethodDescriptionio.grpc.ManagedChannelcreateChannel(String target, ChannelBuilderOptions options) Creates aManagedChannelfor the given target string.booleansupports(io.grpc.ClientInterceptor interceptor) Whether this factory supports the given globalClientInterceptor.booleanWhether this factory supports the given target string.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GrpcChannelFactory
createChannel
-
Constructor Details
-
CompositeGrpcChannelFactory
Creates a new CompositeGrpcChannelFactory with the given factories.- Parameters:
channelFactories- the channel factories
-
-
Method Details
-
supports
Description copied from interface:GrpcChannelFactoryWhether this factory supports the given target string.The target can be either a valid nameresolver-compliant URI or an authority string as described in
Grpc.newChannelBuilder(String, ChannelCredentials), or the name of a user-configured channel (e.g. 'my-channel').- Specified by:
supportsin interfaceGrpcChannelFactory- Parameters:
target- the target string- Returns:
- whether this factory supports the given target string
-
supports
public boolean supports(io.grpc.ClientInterceptor interceptor) Description copied from interface:GrpcChannelFactoryWhether this factory supports the given globalClientInterceptor.- Specified by:
supportsin interfaceGrpcChannelFactory- Parameters:
interceptor- the client interceptor to check support for- Returns:
- whether this factory supports the given interceptor
-
createChannel
Description copied from interface:GrpcChannelFactoryCreates aManagedChannelfor the given target string. The target can beThe target can be either a valid nameresolver-compliant URI or an authority string as described in
Grpc.newChannelBuilder(String, ChannelCredentials), or the name of a user-configured channel (e.g. 'my-channel').The returned channel is configured to use all globally registered
interceptorsand any user-provided interceptor if specified in theoptions.- Specified by:
createChannelin interfaceGrpcChannelFactory- Parameters:
target- the target string as described in method javadocsoptions- the options for building the created channel, orChannelBuilderOptions.defaults()to use default options- Returns:
- a channel for the given target
-