@ConfigurationProperties(value="grpc.server")
public class GrpcServerConfiguration
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT |
static java.lang.String |
HOST |
static java.lang.String |
PORT |
static java.lang.String |
PREFIX |
protected io.grpc.netty.NettyServerBuilder |
serverBuilder |
Constructor and Description |
---|
GrpcServerConfiguration(io.micronaut.context.env.Environment environment,
java.lang.String serverHost,
java.lang.Integer serverPort,
java.util.concurrent.ExecutorService executorService) |
Modifier and Type | Method and Description |
---|---|
io.grpc.ServerBuilder<?> |
getServerBuilder()
The server builder.
|
GrpcSslConfiguration |
getServerConfiguration()
The SSL configuration.
|
java.util.Optional<java.lang.String> |
getServerHost()
The server host.
|
int |
getServerPort()
The server port.
|
boolean |
isSecure()
Whether SSL is used.
|
void |
setMaxInboundMessageSize(int bytes)
Sets the maximum message size allowed to be received on the server.
|
void |
setMaxInboundMetadataSize(int bytes)
Sets the maximum size of metadata allowed to be received.
|
void |
setServerConfiguration(GrpcSslConfiguration sslConfiguration)
Sets the SSL configuration.
|
public static final java.lang.String PREFIX
public static final java.lang.String PORT
public static final java.lang.String HOST
public static final int DEFAULT_PORT
@ConfigurationBuilder(prefixes="") protected final io.grpc.netty.NettyServerBuilder serverBuilder
public GrpcServerConfiguration(io.micronaut.context.env.Environment environment, @Property(name="grpc.server.host") @Nullable java.lang.String serverHost, @Property(name="grpc.server.port") @Nullable java.lang.Integer serverPort, @Named(value="io") java.util.concurrent.ExecutorService executorService)
public boolean isSecure()
@Nonnull public io.grpc.ServerBuilder<?> getServerBuilder()
ServerBuilder
public java.util.Optional<java.lang.String> getServerHost()
public int getServerPort()
public void setMaxInboundMessageSize(@ReadableBytes int bytes)
This method is advisory, and implementations may decide to not enforce this. Currently,
the only known transport to not enforce this is InProcessServer
.
bytes
- the maximum number of bytes a single message can be.java.lang.IllegalArgumentException
- if bytes is negative.java.lang.UnsupportedOperationException
- if unsupported.public void setMaxInboundMetadataSize(@ReadableBytes int bytes)
Integer.MAX_VALUE
disables
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.
bytes
- the maximum size of received metadatajava.lang.IllegalArgumentException
- if bytes is non-positive@Nonnull public GrpcSslConfiguration getServerConfiguration()
@Inject public void setServerConfiguration(GrpcSslConfiguration sslConfiguration)
sslConfiguration
- The server configuration