Class MessagingConfig

java.lang.Object
io.atomix.cluster.messaging.MessagingConfig
All Implemented Interfaces:
Config

public class MessagingConfig extends Object implements Config
Messaging configuration.
  • Constructor Details

    • MessagingConfig

      public MessagingConfig()
  • Method Details

    • getInterfaces

      public List<String> getInterfaces()
      Returns the local interfaces to which to bind the node.
      Returns:
      the local interfaces to which to bind the node
    • setInterfaces

      public MessagingConfig setInterfaces(List<String> interfaces)
      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

      public Integer getPort()
      Returns the local port to which to bind the node.
      Returns:
      the local port to which to bind the node
    • setPort

      public MessagingConfig setPort(Integer port)
      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
    • getConnectionPoolSize

      public int getConnectionPoolSize()
      Returns the connection pool size.
      Returns:
      the connection pool size
    • getShutdownQuietPeriod

      public Duration getShutdownQuietPeriod()
      Returns:
      the configured shutdown quiet period
    • setShutdownQuietPeriod

      public MessagingConfig setShutdownQuietPeriod(Duration shutdownQuietPeriod)
      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

      public Duration getShutdownTimeout()
      Returns:
      the configured shutdown timeout
    • setShutdownTimeout

      public MessagingConfig setShutdownTimeout(Duration shutdownTimeout)
      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

      public MessagingConfig setTlsEnabled(boolean tlsEnabled)
      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

      public MessagingConfig.CompressionAlgorithm getCompressionAlgorithm()
    • setCompressionAlgorithm

      public MessagingConfig setCompressionAlgorithm(MessagingConfig.CompressionAlgorithm algorithm)
    • getCertificateChain

      public File 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

      public MessagingConfig setCertificateChain(File certificateChain)
      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 null
      IllegalArgumentException - if the certificate chain points to a file which does not exist
      IllegalArgumentException - if the certificate chain points to a file which cannot be read
    • getPrivateKey

      public File getPrivateKey()
      Returns:
      the private key of the certificate chain
    • setPrivateKey

      public MessagingConfig setPrivateKey(File privateKey)
      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 null
      IllegalArgumentException - if the private key points to a file which does not exist
      IllegalArgumentException - 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

      public File getKeyStore()
    • getKeyStorePassword

      public String getKeyStorePassword()
    • getSocketSendBuffer

      public int getSocketSendBuffer()
      Returns:
      the configured size in bytes for SO_SNDBUF
    • setSocketSendBuffer

      public MessagingConfig setSocketSendBuffer(int socketSendBuffer)
      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
    • setSocketReceiveBuffer

      public MessagingConfig setSocketReceiveBuffer(int socketReceiveBuffer)
      Sets the size of SO_RCVBUF.
      Parameters:
      socketReceiveBuffer - the data size in bytes to use for SO_RCVBUF
      Returns:
      this config for chaining
    • getHeartbeatTimeout

      public Duration getHeartbeatTimeout()
    • setHeartbeatTimeout

      public MessagingConfig setHeartbeatTimeout(Duration heartbeatTimeout)
    • getHeartbeatInterval

      public Duration getHeartbeatInterval()
    • setHeartbeatInterval

      public MessagingConfig setHeartbeatInterval(Duration heartbeatInterval)