java.lang.Object
io.helidon.grpc.client.GrpcChannelsProvider
GrpcChannelsProvider is a factory for pre-configured gRPC Channel instances.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder builds an instance ofGrpcChannelsProvider. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe configuration key for the channels configuration.static final StringA constant for holding the default channel configuration name (which is "default").static final StringA constant for holding the default host name (which is "localhost").static final intA constant for holding the default port (which is "1408"). -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcChannelsProvider.Builderbuilder()Create a newGrpcChannelsProvider.Builder.static GrpcChannelsProvider.BuilderCreate a newGrpcChannelsProvider.Builder.io.grpc.ManagedChannelReturns aManagedChannelfor the specified channel or host name.static GrpcChannelsProvidercreate()Builds a new instance ofGrpcChannelsProviderusing default configuration.static GrpcChannelsProviderCreates aGrpcChannelsProviderusing the specified configuration.
-
Field Details
-
DEFAULT_CHANNEL_NAME
A constant for holding the default channel configuration name (which is "default").- See Also:
-
DEFAULT_HOST
A constant for holding the default host name (which is "localhost").- See Also:
-
CFG_KEY_CHANNELS
The configuration key for the channels configuration.- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORTA constant for holding the default port (which is "1408").- See Also:
-
-
Method Details
-
create
Builds a new instance ofGrpcChannelsProviderusing default configuration. The default configuration connects to "localhost:1408" without TLS.- Returns:
- a new instance of
GrpcChannelsProvider
-
create
Creates aGrpcChannelsProviderusing the specified configuration.- Parameters:
config- The externalized configuration.- Returns:
- a new instance of
GrpcChannelsProvider
-
builder
Create a newGrpcChannelsProvider.Builder.- Returns:
- a new
GrpcChannelsProvider.Builder
-
builder
Create a newGrpcChannelsProvider.Builder.- Parameters:
config- theConfigto bootstrap from- Returns:
- a new
GrpcChannelsProvider.Builder
-
channel
Returns aManagedChannelfor the specified channel or host name.If the specified channel name does not exist in the configuration, we will assume that it represents the name of the gRPC host to connect to and will create a plain text channel to the host with the specified
name, on a default port (1408).- Parameters:
name- the name of the channel configuration as specified in the configuration file, or the name of the host to connect to- Returns:
- a new instance of
ManagedChannel - Throws:
NullPointerException- if name is nullIllegalArgumentException- if name is empty
-