Package io.micronaut.grpc.server
Class GrpcServerConfiguration
java.lang.Object
io.micronaut.grpc.server.GrpcServerConfiguration
Configuration for the GRPC server.
- Since:
- 1.0
- Author:
- graemerocher, Iván López
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionGrpcServerConfiguration(io.micronaut.context.env.Environment environment, @Nullable String serverHost, @Nullable Integer serverPort, ExecutorService executorService, io.micronaut.core.io.ResourceResolver resourceResolver) Default constructor.
- 
Method SummaryModifier and TypeMethodDescriptionGets the maximum duration application will wait for the server to terminate and release all resources.@NonNull StringThe instance id.@NonNull io.grpc.ServerBuilder<?>The server builder.@NonNull GrpcSslConfigurationThe SSL configuration.The server host.intThe server port.booleanisSecure()Whether SSL is used.voidsetAwaitTermination(Duration awaitTermination) Sets the maximum duration application will wait for the server to terminate and release all resources.voidsetInstanceId(String instanceId) Sets the instance id name used for registering the GRPC service in Service Discovery.voidsetMaxInboundMessageSize(int bytes) Sets the maximum message size allowed to be received on the server.voidsetMaxInboundMetadataSize(int bytes) Sets the maximum size of metadata allowed to be received.voidsetServerConfiguration(GrpcSslConfiguration sslConfiguration) Sets the SSL configuration.
- 
Field Details- 
PREFIX- See Also:
 
- 
PORT- See Also:
 
- 
HOST- See Also:
 
- 
ENABLED- See Also:
 
- 
DEFAULT_PORTpublic static final int DEFAULT_PORT- See Also:
 
- 
DEFAULT_AWAIT_TERMINATION
- 
serverBuilder@ConfigurationBuilder(prefixes="", excludes="protocolNegotiator") protected final io.grpc.netty.NettyServerBuilder serverBuilder
 
- 
- 
Constructor Details- 
GrpcServerConfigurationpublic GrpcServerConfiguration(io.micronaut.context.env.Environment environment, @Property(name="grpc.server.host") @Nullable @Nullable String serverHost, @Property(name="grpc.server.port") @Nullable @Nullable Integer serverPort, @Named("io") ExecutorService executorService, io.micronaut.core.io.ResourceResolver resourceResolver) Default constructor.- Parameters:
- environment- The environment
- serverHost- The server host
- serverPort- The server port
- executorService- The IO executor service
- resourceResolver- The resource resolver
 
 
- 
- 
Method Details- 
isSecurepublic boolean isSecure()Whether SSL is used.- Returns:
- True if SSL is used
 
- 
getServerBuilder@NonNull public @NonNull io.grpc.ServerBuilder<?> getServerBuilder()The server builder.- Returns:
- The ServerBuilder
 
- 
getServerHostThe server host.- Returns:
- The server host
 
- 
getServerPortpublic int getServerPort()The server port.- Returns:
- The server port
 
- 
getInstanceIdThe instance id.- Returns:
- The instance id
 
- 
setInstanceIdSets the instance id name used for registering the GRPC service in Service Discovery. If this is not set, the application name will be used.- Parameters:
- instanceId- The instance id
 
- 
setMaxInboundMessageSizepublic void setMaxInboundMessageSize(@ReadableBytes int bytes) Sets the maximum message size allowed to be received on the server. If not called, defaults to 4 MiB. The default provides protection to servers who haven't considered the possibility of receiving large messages while trying to be large enough to not be hit in normal usage.This method is advisory, and implementations may decide to not enforce this. Currently, the only known transport to not enforce this is InProcessServer.- Parameters:
- bytes- the maximum number of bytes a single message can be.
- Throws:
- IllegalArgumentException- if bytes is negative.
- UnsupportedOperationException- if unsupported.
- Since:
- 1.13.0
 
- 
setMaxInboundMetadataSizepublic void setMaxInboundMetadataSize(@ReadableBytes int bytes) Sets the maximum size of metadata allowed to be received.Integer.MAX_VALUEdisables the enforcement. The default is implementation-dependent, but is not generally less than 8 KiB and may be unlimited.This is cumulative size of the metadata. The precise calculation is implementation-dependent, but implementations are encouraged to follow the calculation used for HTTP/2's SETTINGS_MAX_HEADER_LIST_SIZE. It sums the bytes from each entry's key and value, plus 32 bytes of overhead per entry. - Parameters:
- bytes- the maximum size of received metadata
- Throws:
- IllegalArgumentException- if bytes is non-positive
- Since:
- 1.17.0
 
- 
getServerConfigurationThe SSL configuration.- Returns:
- The SSL configuration
 
- 
setAwaitTerminationSets the maximum duration application will wait for the server to terminate and release all resources.- Parameters:
- awaitTermination- The maximum duration the application will wait for the server to terminate.
 
- 
getAwaitTerminationGets the maximum duration application will wait for the server to terminate and release all resources.- Returns:
- The maximum duration the application will wait for the server to terminate.
 
- 
setServerConfigurationSets the SSL configuration.- Parameters:
- sslConfiguration- The server configuration
 
 
-