Package io.atomix.cluster.messaging
Class MessagingConfig
java.lang.Object
io.atomix.cluster.messaging.MessagingConfig
- All Implemented Interfaces:
Config
Messaging configuration.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfigureTls(File keyStore, String keyStorePassword, File privateKey, File certificateChain) The certificate chain to use for inter-cluster communication.Returns the local interfaces to which to bind the node.getPort()Returns the local port to which to bind the node.intintbooleansetCertificateChain(File certificateChain) Sets the certificate chain to use for inter-cluster communication.setHeartbeatInterval(Duration heartbeatInterval) setHeartbeatTimeout(Duration heartbeatTimeout) setInterfaces(List<String> interfaces) Sets the local interfaces to which to bind the node.Sets the local port to which to bind the node.setPrivateKey(File privateKey) Sets the private key of the certificate chain.setShutdownQuietPeriod(Duration shutdownQuietPeriod) Sets the shutdown quiet period.setShutdownTimeout(Duration shutdownTimeout) Sets the shutdown timeout.setSocketReceiveBuffer(int socketReceiveBuffer) Sets the size of SO_RCVBUF.setSocketSendBuffer(int socketSendBuffer) Sets the size of SO_SNDBUF.GatewayCfgTsetTlsEnabled(boolean tlsEnabled) Sets whether or not to enable TLS for inter-cluster communication.
-
Field Details
-
AUTO_SOCKET_SIZE
public static final int AUTO_SOCKET_SIZE- See Also:
-
-
Constructor Details
-
MessagingConfig
public MessagingConfig()
-
-
Method Details
-
getInterfaces
Returns the local interfaces to which to bind the node.- Returns:
- the local interfaces to which to bind the node
-
setInterfaces
Sets the local interfaces to which to bind the node.- Parameters:
interfaces- the local interfaces to which to bind the node- Returns:
- this config for chaining
-
getPort
Returns the local port to which to bind the node.- Returns:
- the local port to which to bind the node
-
setPort
Sets the local port to which to bind the node.- Parameters:
port- the local port to which to bind the node- Returns:
- this config for chaining
-
getShutdownQuietPeriod
- Returns:
- the configured shutdown quiet period
-
setShutdownQuietPeriod
Sets the shutdown quiet period. This is mostly useful to set a small value when testing, otherwise every tests takes an additional 2 second just to shutdown the executor.- Parameters:
shutdownQuietPeriod- the quiet period on shutdown- Returns:
- this config for chaining
-
getShutdownTimeout
- Returns:
- the configured shutdown timeout
-
setShutdownTimeout
Sets the shutdown timeout.- Parameters:
shutdownTimeout- the time to wait for an orderly shutdown of the messaging service- Returns:
- this config for chaining
-
isTlsEnabled
public boolean isTlsEnabled()- Returns:
- true if TLS is enabled for inter-cluster communication
-
setTlsEnabled
Sets whether or not to enable TLS for inter-cluster communication.- Parameters:
tlsEnabled- true to enable TLS between all nodes, false otherwise- Returns:
- this config for chaining
-
getCompressionAlgorithm
-
setCompressionAlgorithm
-
getCertificateChain
The certificate chain to use for inter-cluster communication. This certificate is used for both the server and the client.- Returns:
- a file which contains the certificate chain
-
setCertificateChain
Sets the certificate chain to use for inter-cluster communication. If using a self-signed certificate, or one which is not widely trusted, this must be the complete chain.Mandatory if TLS is enabled.
- Parameters:
certificateChain- a file containing the certificate chain- Returns:
- this config for chaining
- Throws:
IllegalArgumentException- if the certificate chain is nullIllegalArgumentException- if the certificate chain points to a file which does not existIllegalArgumentException- if the certificate chain points to a file which cannot be read
-
getPrivateKey
- Returns:
- the private key of the certificate chain
-
setPrivateKey
Sets the private key of the certificate chain.Mandatory if TLS is enabled.
- Parameters:
privateKey- the private key of the associated certificate chain- Returns:
- this config for chaining
- Throws:
IllegalArgumentException- if the private key is nullIllegalArgumentException- if the private key points to a file which does not existIllegalArgumentException- if the private key points to a file which cannot be read
-
configureTls
public MessagingConfig configureTls(File keyStore, String keyStorePassword, File privateKey, File certificateChain) -
getKeyStore
-
getKeyStorePassword
-
getHeartbeatTimeout
-
setHeartbeatTimeout
-
getHeartbeatInterval
-
setHeartbeatInterval
-
getSocketSendBuffer
public int getSocketSendBuffer()- Returns:
- the configured size in bytes for SO_SNDBUF or `-1` if not configured.
-
setSocketSendBuffer
Sets the size of SO_SNDBUF.GatewayCfgT- Parameters:
socketSendBuffer- the data size in bytes to use for SO_SNDBUF- Returns:
- this config for chaining
-
getSocketReceiveBuffer
public int getSocketReceiveBuffer()- Returns:
- the configured size in bytes for SO_RCVBUF or `-1` if not configured.
-
setSocketReceiveBuffer
Sets the size of SO_RCVBUF.- Parameters:
socketReceiveBuffer- the data size in bytes to use for SO_RCVBUF- Returns:
- this config for chaining
-