java.lang.Object
io.helidon.grpc.client.GrpcChannelsProvider
GrpcChannelsProvider is a factory for pre-configured gRPC Channel instances.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder builds an instance ofGrpcChannelsProvider
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The configuration key for the channels configuration.static final String
A constant for holding the default channel configuration name (which is "default").static final String
A constant for holding the default host name (which is "localhost").static final int
A constant for holding the default port (which is "1408"). -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcChannelsProvider.Builder
builder()
Create a newGrpcChannelsProvider.Builder
.static GrpcChannelsProvider.Builder
Create a newGrpcChannelsProvider.Builder
.io.grpc.ManagedChannel
Returns aManagedChannel
for the specified channel or host name.static GrpcChannelsProvider
create()
Builds a new instance ofGrpcChannelsProvider
using default configuration.static GrpcChannelsProvider
Creates aGrpcChannelsProvider
using 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 ofGrpcChannelsProvider
using default configuration. The default configuration connects to "localhost:1408" without TLS.- Returns:
- a new instance of
GrpcChannelsProvider
-
create
Creates aGrpcChannelsProvider
using 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
- theConfig
to bootstrap from- Returns:
- a new
GrpcChannelsProvider.Builder
-
channel
Returns aManagedChannel
for 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
-