@ConfigurationProperties(value="grpc.server") public class GrpcServerProperties extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GrpcServerProperties.Security
The security configuration for the gRPC server.
|
Modifier and Type | Field and Description |
---|---|
static String |
ANY_IP_ADDRESS
A constant that defines, that the server should listen to any IPv4 and IPv6 address.
|
static String |
ANY_IPv4_ADDRESS
A constant that defines, that the server should listen to any IPv4 address.
|
static String |
ANY_IPv6_ADDRESS
A constant that defines, that the server should listen to any IPv6 address.
|
Constructor and Description |
---|
GrpcServerProperties() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
String |
getAddress()
Bind address for the server.
|
String |
getInProcessName()
The name of the in-process server.
|
Duration |
getKeepAliveTime()
The default delay before we send a keepAlives.
|
Duration |
getKeepAliveTimeout()
The default timeout for a keepAlives ping request.
|
Duration |
getMaxConnectionAge()
Specify a max connection age.
|
Duration |
getMaxConnectionAgeGrace()
Specify a grace time for the graceful max connection age termination.
|
Duration |
getMaxConnectionIdle()
Specify a max connection idle time.
|
DataSize |
getMaxInboundMessageSize()
The maximum message size allowed to be received by the server.
|
DataSize |
getMaxInboundMetadataSize()
The maximum size of metadata allowed to be received.
|
Duration |
getPermitKeepAliveTime()
Specify the most aggressive keep-alive time clients are permitted to configure.
|
int |
getPort()
Gets the port the server should listen on.
|
GrpcServerProperties.Security |
getSecurity()
Security options for transport security.
|
Duration |
getShutdownGracePeriod()
The time to wait for the server to gracefully shutdown (completing all requests after the server started to
shutdown).
|
int |
hashCode() |
boolean |
isEnableKeepAlive()
Setting to enable keepAlive.
|
boolean |
isHealthServiceEnabled()
Whether gRPC health service is enabled or not.
|
boolean |
isPermitKeepAliveWithoutCalls()
Whether clients are allowed to send keep-alive HTTP/2 PINGs even if there are no outstanding RPCs on the
connection.
|
boolean |
isReflectionServiceEnabled()
Whether proto reflection service is enabled or not.
|
void |
setAddress(String address)
Bind address for the server.
|
void |
setEnableKeepAlive(boolean enableKeepAlive)
Setting to enable keepAlive.
|
void |
setHealthServiceEnabled(boolean healthServiceEnabled)
Whether gRPC health service is enabled or not.
|
void |
setInProcessName(String inProcessName)
The name of the in-process server.
|
void |
setKeepAliveTime(Duration keepAliveTime)
The default delay before we send a keepAlives.
|
void |
setKeepAliveTimeout(Duration keepAliveTimeout)
The default timeout for a keepAlives ping request.
|
void |
setMaxConnectionAge(Duration maxConnectionAge)
Specify a max connection age.
|
void |
setMaxConnectionAgeGrace(Duration maxConnectionAgeGrace)
Specify a grace time for the graceful max connection age termination.
|
void |
setMaxConnectionIdle(Duration maxConnectionIdle)
Specify a max connection idle time.
|
void |
setMaxInboundMessageSize(DataSize maxInboundMessageSize)
Sets the maximum message size allowed to be received by the server.
|
void |
setMaxInboundMetadataSize(DataSize maxInboundMetadataSize)
Sets the maximum metadata size allowed to be received by the server.
|
void |
setPermitKeepAliveTime(Duration permitKeepAliveTime)
Specify the most aggressive keep-alive time clients are permitted to configure.
|
void |
setPermitKeepAliveWithoutCalls(boolean permitKeepAliveWithoutCalls)
Whether clients are allowed to send keep-alive HTTP/2 PINGs even if there are no outstanding RPCs on the
connection.
|
void |
setPort(int port)
Server port to listen on.
|
void |
setReflectionServiceEnabled(boolean reflectionServiceEnabled)
Whether proto reflection service is enabled or not.
|
void |
setShutdownGracePeriod(Duration shutdownGracePeriod)
The time to wait for the server to gracefully shutdown (completing all requests after the server started to
shutdown).
|
String |
toString() |
public static final String ANY_IP_ADDRESS
public static final String ANY_IPv4_ADDRESS
public static final String ANY_IPv6_ADDRESS
public int getPort()
9090
. If set to 0
a random available port
will be selected and used.setPort(int)
public void setMaxInboundMessageSize(DataSize maxInboundMessageSize)
null
) then it will
default to gRPC's default
. If set to -1
then it will use the
highest possible limit (not recommended).maxInboundMessageSize
- The new maximum size allowed for incoming messages. -1
for max possible.
Null to use the gRPC's default.ServerBuilder.maxInboundMessageSize(int)
public void setMaxInboundMetadataSize(DataSize maxInboundMetadataSize)
null
) then it will
default to gRPC's default
. If set to -1
then it will use
the highest possible limit (not recommended).maxInboundMetadataSize
- The new maximum size allowed for incoming metadata. -1
for max possible.
Null to use the gRPC's default.ServerBuilder.maxInboundMetadataSize(int)
public String getAddress()
"*"
. Alternatively you can restrict this to
"0.0.0.0"
or "::"
. Or restrict it to exactly one IP address.
On unix systems it is also possible to prefix it with unix:
to use
domain socket addresses/paths (Additional dependencies may be required).public String getInProcessName()
public Duration getShutdownGracePeriod()
0
the server will force
shutdown immediately. Defaults to 30s
.public boolean isEnableKeepAlive()
false
.public Duration getKeepAliveTime()
2h
. Default unit SECONDS
.setEnableKeepAlive(boolean)
,
NettyServerBuilder.keepAliveTime(long, TimeUnit)
public Duration getKeepAliveTimeout()
20s
. Default unit
SECONDS
.setEnableKeepAlive(boolean)
,
NettyServerBuilder.keepAliveTimeout(long, TimeUnit)
public Duration getPermitKeepAliveTime()
5min
. Default
unit SECONDS
.NettyServerBuilder.permitKeepAliveTime(long, TimeUnit)
public boolean isPermitKeepAliveWithoutCalls()
false
.NettyServerBuilder.permitKeepAliveWithoutCalls(boolean)
public Duration getMaxConnectionIdle()
SECONDS
.NettyServerBuilder.maxConnectionIdle(long, TimeUnit)
public Duration getMaxConnectionAge()
SECONDS
.NettyServerBuilder.maxConnectionAge(long, TimeUnit)
public Duration getMaxConnectionAgeGrace()
SECONDS
.NettyServerBuilder.maxConnectionAgeGrace(long, TimeUnit)
public DataSize getMaxInboundMessageSize()
null
) then
gRPC's default
should be used.public DataSize getMaxInboundMetadataSize()
null
) then
gRPC's default
should be used.public boolean isHealthServiceEnabled()
true
.public boolean isReflectionServiceEnabled()
true
.public GrpcServerProperties.Security getSecurity()
public void setAddress(String address)
"*"
. Alternatively you can restrict this to
"0.0.0.0"
or "::"
. Or restrict it to exactly one IP address.
On unix systems it is also possible to prefix it with unix:
to use
domain socket addresses/paths (Additional dependencies may be required).address
- The address to bind to.public void setPort(int port)
9090
. If set to 0
a random available port will be selected
and used. Use -1
to disable the inter-process server (for example if you only want to use the in-process
server).port
- The port the server should listen on.public void setInProcessName(String inProcessName)
inProcessName
- The name of the in-process server.public void setShutdownGracePeriod(Duration shutdownGracePeriod)
0
the server will force
shutdown immediately. Defaults to 30s
.gracefullShutdownTimeout
- The time to wait for a graceful shutdown.public void setEnableKeepAlive(boolean enableKeepAlive)
false
.enableKeepAlive
- Whether keep alive should be enabled.public void setKeepAliveTime(Duration keepAliveTime)
2h
. Default unit SECONDS
.keepAliveTime
- The new default delay before sending keepAlives.setEnableKeepAlive(boolean)
,
NettyServerBuilder.keepAliveTime(long, TimeUnit)
public void setKeepAliveTimeout(Duration keepAliveTimeout)
20s
. Default unit
SECONDS
.keepAliveTimeout
- Sets the default timeout for a keepAlives ping request.setEnableKeepAlive(boolean)
,
NettyServerBuilder.keepAliveTimeout(long, TimeUnit)
public void setPermitKeepAliveTime(Duration permitKeepAliveTime)
5min
. Default
unit SECONDS
.permitKeepAliveTime
- The most aggressive keep-alive time clients are permitted to configure.NettyServerBuilder.permitKeepAliveTime(long, TimeUnit)
public void setPermitKeepAliveWithoutCalls(boolean permitKeepAliveWithoutCalls)
false
.permitKeepAliveWithoutCalls
- Whether to allow clients to send keep-alive requests without calls.NettyServerBuilder.permitKeepAliveWithoutCalls(boolean)
public void setMaxConnectionIdle(Duration maxConnectionIdle)
SECONDS
.maxConnectionIdle
- The max connection idle time.NettyServerBuilder.maxConnectionIdle(long, TimeUnit)
public void setMaxConnectionAge(Duration maxConnectionAge)
SECONDS
.maxConnectionAge
- The max connection age.NettyServerBuilder.maxConnectionAge(long, TimeUnit)
public void setMaxConnectionAgeGrace(Duration maxConnectionAgeGrace)
SECONDS
.maxConnectionAgeGrace
- The max connection age grace time.NettyServerBuilder.maxConnectionAgeGrace(long, TimeUnit)
public void setHealthServiceEnabled(boolean healthServiceEnabled)
true
.healthServiceEnabled
- Whether gRPC health service is enabled.public void setReflectionServiceEnabled(boolean reflectionServiceEnabled)
true
.reflectionServiceEnabled
- Whether gRPC reflection service is enabled.protected boolean canEqual(Object other)