Package org.summerboot.jexpress.nio.grpc
Class GRPCClientConfig
java.lang.Object
org.summerboot.jexpress.boot.config.BootConfig
org.summerboot.jexpress.nio.grpc.GRPCClientConfig
- All Implemented Interfaces:
JExpressConfig
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.summerboot.jexpress.boot.config.BootConfig
BootConfig.ThreadingMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilderprotected Listprotected static final Stringprotected static final Stringprotected Longprotected Longprotected Longprotected Booleanprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected KeyManagerFactoryprotected GRPCClientConfig.LoadBalancingPolicyprotected List<InetSocketAddress> protected Stringprotected Integerprotected Integerprotected Integerprotected Integerprotected io.grpc.NameResolverProviderprotected Stringprotected Longprotected static intprotected Longprotected Booleanprotected String[]protected TrustManagerFactoryprotected URIprotected StringFields inherited from class org.summerboot.jexpress.boot.config.BootConfig
BR, cache, cfgFile, configName, CPU_CORE, DESC_KMF, DESC_PLAINPWD, DESC_TMF, FILENAME_KEYSTORE, FILENAME_SRC_TRUSTSTORE, generateTemplate, logger, props -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigUpdateListener(GRPCClient listener) protected voidconfigNettyChannelBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder nettyChannelBuilder) protected voidprotected voidio.grpc.netty.shaded.io.grpc.netty.NettyChannelBuildergetKmf()io.grpc.NameResolverProviderString[]getTmf()getUri()static io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilderinitNettyChannelBuilder(io.grpc.NameResolverProvider nameResolverProvider, GRPCClientConfig.LoadBalancingPolicy loadBalancingPolicy, URI uri, KeyManagerFactory keyManagerFactory, TrustManagerFactory trustManagerFactory, String overrideAuthority, Iterable<String> ciphers, String... tlsVersionProtocols) protected voidloadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) static voidprotected voidpreLoad(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) voidremoveConfigUpdateListener(GRPCClient listener) voidshutdown()Methods inherited from class org.summerboot.jexpress.boot.config.BootConfig
buildThreadPoolExecutor, buildThreadPoolExecutor, buildThreadPoolExecutor, createIfNotExist, generateTemplate, getCfgFile, getLength, getProperties, info, instance, lineBreak, load, loadField, name, parse, registerSingleton, temp, updateConfigFile, updateFilePath
-
Field Details
-
FILENAME_TRUSTSTORE_4CLIENT
- See Also:
-
ID
- See Also:
-
loadBalancingServers
@ConfigHeader(title="1. gRpc.client provider", format="server1:port1, server2:port2, ..., serverN:portN", example="localhost:8424, remotehost:8425, 127.0.0.1:8426") @Config(key="gRpc.client.LoadBalancing.servers", predefinedValue="0.0.0.0:8424, 0.0.0.0:8425", required=false) protected volatile List<InetSocketAddress> loadBalancingServers -
loadBalancingTargetScheme
@Config(key="gRpc.client.LoadBalancing.scheme", defaultValue="grpc", desc="In case you have more than one gRPC client needs to connect to different gRPC services, you can set this to distinguish them") protected volatile String loadBalancingTargetScheme -
loadBalancingPolicy
@Config(key="gRpc.client.LoadBalancing.policy", defaultValue="ROUND_ROBIN", desc="available options: ROUND_ROBIN, PICK_FIRST") protected volatile GRPCClientConfig.LoadBalancingPolicy loadBalancingPolicy -
nameResolverProvider
protected volatile io.grpc.NameResolverProvider nameResolverProvider -
uri
@Config(key="gRpc.client.target.url", defaultValue="grpc:///", desc="grpc:///\ngrpc://127.0.0.1:8424\nunix:/tmp/grpcsrver.socket") protected volatile URI uri -
sslProtocols
-
ciphers
-
KEY_kmf_key
- See Also:
-
KEY_kmf_StorePwdKey
- See Also:
-
KEY_kmf_AliasKey
- See Also:
-
KEY_kmf_AliasPwdKey
- See Also:
-
kmf
@ConfigHeader(title="2. gRpc.client keystore") @Config(key="gRpc.client.ssl.KeyStore", StorePwdKey="gRpc.client.ssl.KeyStorePwd", AliasKey="gRpc.client.ssl.KeyAlias", AliasPwdKey="gRpc.client.ssl.KeyPwd", desc="Path to key store file. Use SSL/TLS when keystore is provided, otherwise use plain socket", callbackMethodName4Dump="generateTemplate_keystore") protected volatile KeyManagerFactory kmf -
KEY_tmf_key
- See Also:
-
KEY_tmf_StorePwdKey
- See Also:
-
tmf
@ConfigHeader(title="3. gRpc.client truststore") @Config(key="gRpc.client.ssl.TrustStore", StorePwdKey="gRpc.client.ssl.TrustStorePwd", callbackMethodName4Dump="generateTemplate_truststore", desc="Path to trust store file. Auth the remote peer certificate when a truststore is provided, otherwise blindly trust all remote peer certificate") protected volatile TrustManagerFactory tmf -
overrideAuthority
@Config(key="gRpc.client.ssl.overrideAuthority", predefinedValue="server2.4096.jexpress.org", desc="NOT for PRODUCTION! Set server certificate DNS name here when server is not yet running on its certificate Subject Alternative Names (SAN)") protected volatile String overrideAuthority -
channelBuilder
protected volatile io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder channelBuilder -
userAgent
-
maxInboundMessageSize
-
maxHeaderListSize
-
perRpcBufferLimit
-
maxHedgedAttempts
-
idleTimeoutSeconds
-
keepAliveWithoutCalls
-
keepAliveTimeSeconds
-
keepAliveTimeoutSeconds
@Config(key="gRpc.client.channel.keepAliveTimeoutSeconds", desc="long: default 20 seconds if not set. The timeout in seconds for a PING frame to be acknowledged. If sender does not receive an acknowledgment within this time, it will close the connection.") protected volatile Long keepAliveTimeoutSeconds -
retryEnabled
-
maxRetryAttempts
-
retryBufferSize
-
priority
protected static int priority
-
-
Constructor Details
-
GRPCClientConfig
protected GRPCClientConfig()
-
-
Method Details
-
main
-
generateTemplate_keystore
-
generateTemplate_truststore
-
preLoad
- Overrides:
preLoadin classBootConfig
-
loadCustomizedConfigs
protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) throws IOException - Specified by:
loadCustomizedConfigsin classBootConfig- Throws:
IOException
-
configNettyChannelBuilder
protected void configNettyChannelBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder nettyChannelBuilder) -
shutdown
public void shutdown() -
addConfigUpdateListener
-
removeConfigUpdateListener
-
initNettyChannelBuilder
public static io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder initNettyChannelBuilder(io.grpc.NameResolverProvider nameResolverProvider, GRPCClientConfig.LoadBalancingPolicy loadBalancingPolicy, URI uri, @Nullable KeyManagerFactory keyManagerFactory, @Nullable TrustManagerFactory trustManagerFactory, @Nullable String overrideAuthority, @Nullable Iterable<String> ciphers, @Nullable String... tlsVersionProtocols) throws SSLException - Parameters:
nameResolverProvider- for client side load balancingloadBalancingPolicy-uri- The URI format should be one of grpc://host:port, grpcs://host:port, or unix:///path/to/uds.sockkeyManagerFactory- The Remote Caller identitytrustManagerFactory- The Remote Caller trusted identitiesoverrideAuthority-ciphers-tlsVersionProtocols- "TLSv1.2", "TLSv1.3"- Returns:
- Throws:
SSLException
-
getLoadBalancingServers
-
getLoadBalancingPolicy
-
getNameResolverProvider
public io.grpc.NameResolverProvider getNameResolverProvider() -
getUri
-
getSslProtocols
-
getCiphers
-
getKmf
-
getTmf
-
getOverrideAuthority
-
getChannelBuilder
public io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder getChannelBuilder()
-