Package net.devh.boot.grpc.server.config
Class GrpcServerProperties
java.lang.Object
net.devh.boot.grpc.server.config.GrpcServerProperties
The properties for the gRPC server that will be started as part of the application.
- Since:
- 5/17/16
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The security configuration for the gRPC server. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
A constant that defines, that the server should listen to any IPv4 and IPv6 address.static final String
A constant that defines, that the server should listen to any IPv4 address.static final String
A constant that defines, that the server should listen to any IPv6 address. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
Bind address for the server.The name of the in-process server.The default delay before we send a keepAlives.The default timeout for a keepAlives ping request.Specify a max connection age.Specify a grace time for the graceful max connection age termination.Specify a max connection idle time.The maximum message size allowed to be received by the server.The maximum size of metadata allowed to be received.Specify the most aggressive keep-alive time clients are permitted to configure.int
getPort()
Gets the port the server should listen on.Security options for transport security.The time to wait for the server to gracefully shutdown (completing all requests after the server started to shutdown).int
hashCode()
boolean
Setting to enable keepAlive.boolean
Whether gRPC health service is enabled or not.boolean
Whether clients are allowed to send keep-alive HTTP/2 PINGs even if there are no outstanding RPCs on the connection.boolean
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).toString()
-
Field Details
-
ANY_IP_ADDRESS
A constant that defines, that the server should listen to any IPv4 and IPv6 address.- See Also:
-
ANY_IPv4_ADDRESS
A constant that defines, that the server should listen to any IPv4 address.- See Also:
-
ANY_IPv6_ADDRESS
A constant that defines, that the server should listen to any IPv6 address.- See Also:
-
-
Constructor Details
-
GrpcServerProperties
public GrpcServerProperties()
-
-
Method Details
-
getPort
public int getPort()Gets the port the server should listen on. Defaults to9090
. If set to0
a random available port will be selected and used.- Returns:
- The server port to listen to.
- See Also:
-
setMaxInboundMessageSize
Sets the maximum message size allowed to be received by the server. If not set (null
) then it will default togRPC's default
. If set to-1
then it will use the highest possible limit (not recommended).- Parameters:
maxInboundMessageSize
- The new maximum size allowed for incoming messages.-1
for max possible. Null to use the gRPC's default.- See Also:
-
setMaxInboundMetadataSize
Sets the maximum metadata size allowed to be received by the server. If not set (null
) then it will default togRPC's default
. If set to-1
then it will use the highest possible limit (not recommended).- Parameters:
maxInboundMetadataSize
- The new maximum size allowed for incoming metadata.-1
for max possible. Null to use the gRPC's default.- See Also:
-
getAddress
Bind address for the server. Defaults to"*"
. 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 withunix:
to use domain socket addresses/paths (Additional dependencies may be required).- Returns:
- The address the server should bind to.
-
getInProcessName
The name of the in-process server. If not set, then the in process server won't be started.- Returns:
- The name of the in-process server or null if isn't configured.
-
getShutdownGracePeriod
The time to wait for the server to gracefully shutdown (completing all requests after the server started to shutdown). If set to a negative value, the server waits forever. If set to0
the server will force shutdown immediately. Defaults to30s
.- Returns:
- The time to wait for a graceful shutdown.
-
isEnableKeepAlive
public boolean isEnableKeepAlive()Setting to enable keepAlive. Default tofalse
.- Returns:
- True, if keep alive should be enabled. False otherwise.
-
getKeepAliveTime
The default delay before we send a keepAlives. Defaults to2h
. Default unitSECONDS
.- Returns:
- The default delay before sending keepAlives.
- See Also:
-
setEnableKeepAlive(boolean)
NettyServerBuilder.keepAliveTime(long, TimeUnit)
-
getKeepAliveTimeout
The default timeout for a keepAlives ping request. Defaults to20s
. Default unitSECONDS
.- Returns:
- The default timeout for a keepAlives ping request.
- See Also:
-
setEnableKeepAlive(boolean)
NettyServerBuilder.keepAliveTimeout(long, TimeUnit)
-
getPermitKeepAliveTime
Specify the most aggressive keep-alive time clients are permitted to configure. Defaults to5min
. Default unitSECONDS
.- Returns:
- The most aggressive keep-alive time clients are permitted to configure.
- See Also:
-
NettyServerBuilder.permitKeepAliveTime(long, TimeUnit)
-
isPermitKeepAliveWithoutCalls
public boolean isPermitKeepAliveWithoutCalls()Whether clients are allowed to send keep-alive HTTP/2 PINGs even if there are no outstanding RPCs on the connection. Defaults tofalse
.- Returns:
- True, if clients are allowed to send keep-alive requests without calls. False otherwise.
- See Also:
-
NettyServerBuilder.permitKeepAliveWithoutCalls(boolean)
-
getMaxConnectionIdle
Specify a max connection idle time. Defaults to disabled. Default unitSECONDS
.- Returns:
- The max connection idle time.
- See Also:
-
NettyServerBuilder.maxConnectionIdle(long, TimeUnit)
-
getMaxConnectionAge
Specify a max connection age. Defaults to disabled. Default unitSECONDS
.- Returns:
- The max connection age.
- See Also:
-
NettyServerBuilder.maxConnectionAge(long, TimeUnit)
-
getMaxConnectionAgeGrace
Specify a grace time for the graceful max connection age termination. Defaults to disabled. Default unitSECONDS
.- Returns:
- The max connection age grace time.
- See Also:
-
NettyServerBuilder.maxConnectionAgeGrace(long, TimeUnit)
-
getMaxInboundMessageSize
The maximum message size allowed to be received by the server. If not set (null
) thengRPC's default
should be used.- Returns:
- The maximum message size allowed.
-
getMaxInboundMetadataSize
The maximum size of metadata allowed to be received. If not set (null
) thengRPC's default
should be used.- Returns:
- The maximum metadata size allowed.
-
isHealthServiceEnabled
public boolean isHealthServiceEnabled()Whether gRPC health service is enabled or not. Defaults totrue
.- Returns:
- True, if the health service is enabled. False otherwise.
-
isReflectionServiceEnabled
public boolean isReflectionServiceEnabled()Whether proto reflection service is enabled or not. Defaults totrue
.- Returns:
- True, if the reflection service is enabled. False otherwise.
-
getSecurity
Security options for transport security. Defaults to disabled. We strongly recommend to enable this though.- Returns:
- The security options for transport security.
-
setAddress
Bind address for the server. Defaults to"*"
. 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 withunix:
to use domain socket addresses/paths (Additional dependencies may be required).- Parameters:
address
- The address to bind to.
-
setPort
public void setPort(int port) Server port to listen on. Defaults to9090
. If set to0
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).- Parameters:
port
- The port the server should listen on.
-
setInProcessName
The name of the in-process server. If not set, then the in process server won't be started.- Parameters:
inProcessName
- The name of the in-process server.
-
setShutdownGracePeriod
The time to wait for the server to gracefully shutdown (completing all requests after the server started to shutdown). If set to a negative value, the server waits forever. If set to0
the server will force shutdown immediately. Defaults to30s
.- Parameters:
shutdownGracePeriod
- The time to wait for a graceful shutdown.
-
setEnableKeepAlive
public void setEnableKeepAlive(boolean enableKeepAlive) Setting to enable keepAlive. Default tofalse
.- Parameters:
enableKeepAlive
- Whether keep alive should be enabled.
-
setKeepAliveTime
The default delay before we send a keepAlives. Defaults to2h
. Default unitSECONDS
.- Parameters:
keepAliveTime
- The new default delay before sending keepAlives.- See Also:
-
setEnableKeepAlive(boolean)
NettyServerBuilder.keepAliveTime(long, TimeUnit)
-
setKeepAliveTimeout
The default timeout for a keepAlives ping request. Defaults to20s
. Default unitSECONDS
.- Parameters:
keepAliveTimeout
- Sets the default timeout for a keepAlives ping request.- See Also:
-
setEnableKeepAlive(boolean)
NettyServerBuilder.keepAliveTimeout(long, TimeUnit)
-
setPermitKeepAliveTime
Specify the most aggressive keep-alive time clients are permitted to configure. Defaults to5min
. Default unitSECONDS
.- Parameters:
permitKeepAliveTime
- The most aggressive keep-alive time clients are permitted to configure.- See Also:
-
NettyServerBuilder.permitKeepAliveTime(long, TimeUnit)
-
setPermitKeepAliveWithoutCalls
public 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. Defaults tofalse
.- Parameters:
permitKeepAliveWithoutCalls
- Whether to allow clients to send keep-alive requests without calls.- See Also:
-
NettyServerBuilder.permitKeepAliveWithoutCalls(boolean)
-
setMaxConnectionIdle
Specify a max connection idle time. Defaults to disabled. Default unitSECONDS
.- Parameters:
maxConnectionIdle
- The max connection idle time.- See Also:
-
NettyServerBuilder.maxConnectionIdle(long, TimeUnit)
-
setMaxConnectionAge
Specify a max connection age. Defaults to disabled. Default unitSECONDS
.- Parameters:
maxConnectionAge
- The max connection age.- See Also:
-
NettyServerBuilder.maxConnectionAge(long, TimeUnit)
-
setMaxConnectionAgeGrace
Specify a grace time for the graceful max connection age termination. Defaults to disabled. Default unitSECONDS
.- Parameters:
maxConnectionAgeGrace
- The max connection age grace time.- See Also:
-
NettyServerBuilder.maxConnectionAgeGrace(long, TimeUnit)
-
setHealthServiceEnabled
public void setHealthServiceEnabled(boolean healthServiceEnabled) Whether gRPC health service is enabled or not. Defaults totrue
.- Parameters:
healthServiceEnabled
- Whether gRPC health service is enabled.
-
setReflectionServiceEnabled
public void setReflectionServiceEnabled(boolean reflectionServiceEnabled) Whether proto reflection service is enabled or not. Defaults totrue
.- Parameters:
reflectionServiceEnabled
- Whether gRPC reflection service is enabled.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-