Package io.helidon.grpc.client
Class GrpcChannelsProvider
- java.lang.Object
-
- io.helidon.grpc.client.GrpcChannelsProvider
-
public class GrpcChannelsProvider extends Object
GrpcChannelsProvider is a factory for pre-configured gRPC Channel instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGrpcChannelsProvider.BuilderBuilder builds an instance ofGrpcChannelsProvider.
-
Field Summary
Fields Modifier and Type Field Description static StringCFG_KEY_CHANNELSThe configuration key for the channels configuration.static StringDEFAULT_CHANNEL_NAMEA constant for holding the default channel configuration name (which is "default").static StringDEFAULT_HOSTA constant for holding the default host name (which is "localhost").static intDEFAULT_PORTA constant for holding the default port (which is "1408").
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GrpcChannelsProvider.Builderbuilder()Create a newGrpcChannelsProvider.Builder.static GrpcChannelsProvider.Builderbuilder(Config config)Create a newGrpcChannelsProvider.Builder.io.grpc.Channelchannel(String name)Returns aChannelfor the specified channel configuration name.static GrpcChannelsProvidercreate()Builds a new instance ofGrpcChannelsProviderusing default configuration.static GrpcChannelsProvidercreate(Config config)Creates aGrpcChannelsProviderusing the specified configuration.
-
-
-
Field Detail
-
DEFAULT_CHANNEL_NAME
public static final String DEFAULT_CHANNEL_NAME
A constant for holding the default channel configuration name (which is "default").- See Also:
- Constant Field Values
-
DEFAULT_HOST
public static final String DEFAULT_HOST
A constant for holding the default host name (which is "localhost").- See Also:
- Constant Field Values
-
CFG_KEY_CHANNELS
public static final String CFG_KEY_CHANNELS
The configuration key for the channels configuration.- See Also:
- Constant Field Values
-
DEFAULT_PORT
public static final int DEFAULT_PORT
A constant for holding the default port (which is "1408").- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static GrpcChannelsProvider create()
Builds a new instance ofGrpcChannelsProviderusing default configuration. The default configuration connects to "localhost:1408" without SSL.- Returns:
- a new instance of
GrpcChannelsProvider
-
create
public static GrpcChannelsProvider create(Config config)
Creates aGrpcChannelsProviderusing the specified configuration.- Parameters:
config- The externalized configuration.- Returns:
- a new instance of
GrpcChannelsProvider
-
builder
public static GrpcChannelsProvider.Builder builder()
Create a newGrpcChannelsProvider.Builder.- Returns:
- a new
GrpcChannelsProvider.Builder
-
builder
public static GrpcChannelsProvider.Builder builder(Config config)
Create a newGrpcChannelsProvider.Builder.- Parameters:
config- theConfigto bootstrap from- Returns:
- a new
GrpcChannelsProvider.Builder
-
channel
public io.grpc.Channel channel(String name)
Returns aChannelfor the specified channel configuration name.- Parameters:
name- the name of the channel configuration as specified in the configuration file- Returns:
- a new instance of
Channel - Throws:
NullPointerException- if name is nullIllegalArgumentException- if name is empty
-
-