Class TcpClientConfig


@Unstable public class TcpClientConfig extends TcpEndpointConfig
Configuration of a NetClient
Author:
Julien Viet
  • Constructor Details

    • TcpClientConfig

      public TcpClientConfig()
    • TcpClientConfig

      public TcpClientConfig(TcpClientConfig other)
    • TcpClientConfig

      public TcpClientConfig(NetClientOptions options)
    • TcpClientConfig

      public TcpClientConfig(ClientOptionsBase options)
  • Method Details

    • setTransportConfig

      public TcpClientConfig setTransportConfig(TcpConfig transportConfig)
      Description copied from class: TcpEndpointConfig
      Set the client TCP transport config.
      Overrides:
      setTransportConfig in class TcpEndpointConfig
      Parameters:
      transportConfig - the transport config
      Returns:
      a reference to this, so the API can be used fluently
    • setIdleTimeout

      public TcpClientConfig setIdleTimeout(Duration idleTimeout)
      Description copied from class: EndpointConfig
      Set the stream idle timeout, zero or null means don't time out. This determines if a stream will timeout and be closed if no data is received nor sent within the timeout.
      Overrides:
      setIdleTimeout in class TcpEndpointConfig
      Parameters:
      idleTimeout - the idle timeout
      Returns:
      a reference to this, so the API can be used fluently
    • setReadIdleTimeout

      public TcpClientConfig setReadIdleTimeout(Duration idleTimeout)
      Description copied from class: EndpointConfig

      Set the stream read idle timeout, zero or null means or null means don't time out. This determines if a stream will timeout and be closed if no data is received within the timeout.

      Overrides:
      setReadIdleTimeout in class TcpEndpointConfig
      Parameters:
      idleTimeout - the read idle timeout
      Returns:
      a reference to this, so the API can be used fluently
    • setWriteIdleTimeout

      public TcpClientConfig setWriteIdleTimeout(Duration idleTimeout)
      Description copied from class: EndpointConfig

      Set the stream write idle timeout, zero or null means don't time out. This determines if a stream will timeout and be closed if no data is sent within the timeout.

      Overrides:
      setWriteIdleTimeout in class TcpEndpointConfig
      Parameters:
      idleTimeout - the write idle timeout
      Returns:
      a reference to this, so the API can be used fluently
    • setMetricsName

      public TcpClientConfig setMetricsName(String metricsName)
      Description copied from class: EndpointConfig
      Set the metrics name identifying the reported metrics, useful for grouping metrics with the same name.
      Overrides:
      setMetricsName in class TcpEndpointConfig
      Parameters:
      metricsName - the metrics name
      Returns:
      a reference to this, so the API can be used fluently
    • setLogConfig

      public TcpClientConfig setLogConfig(LogConfig config)
      Description copied from class: EndpointConfig
      Configure the log config: Netty's stream pipeline is configured for logging on Netty's logger.
      Overrides:
      setLogConfig in class TcpEndpointConfig
      Parameters:
      config - the log config
      Returns:
      a reference to this, so the API can be used fluently
    • setSsl

      public TcpClientConfig setSsl(boolean ssl)
      Description copied from class: TcpEndpointConfig
      Set whether SSL/TLS is enabled
      Overrides:
      setSsl in class TcpEndpointConfig
      Parameters:
      ssl - true if enabled
      Returns:
      a reference to this, so the API can be used fluently
    • getConnectTimeout

      public Duration getConnectTimeout()
      Returns:
      the value of connect timeout
    • setConnectTimeout

      public TcpClientConfig setConnectTimeout(Duration connectTimeout)
      Set the connect timeout
      Parameters:
      connectTimeout - connect timeout, in ms
      Returns:
      a reference to this, so the API can be used fluently
    • getProxyOptions

      public ProxyOptions getProxyOptions()
      Get proxy options for connections
      Returns:
      proxy options
    • setProxyOptions

      public TcpClientConfig setProxyOptions(ProxyOptions proxyOptions)
      Set proxy options for connections via CONNECT proxy (e.g. Squid) or a SOCKS proxy.
      Parameters:
      proxyOptions - proxy options object
      Returns:
      a reference to this, so the API can be used fluently
    • getNonProxyHosts

      public List<String> getNonProxyHosts()
      Returns:
      the list of non proxies hosts
    • setNonProxyHosts

      public TcpClientConfig setNonProxyHosts(List<String> nonProxyHosts)
      Set a list of remote hosts that are not proxied when the client is configured to use a proxy. This list serves the same purpose than the JVM nonProxyHosts configuration.

      Entries can use the * wildcard character for pattern matching, e.g *.example.com matches www.example.com.

      Parameters:
      nonProxyHosts - the list of non proxies hosts
      Returns:
      a reference to this, so the API can be used fluently
    • addNonProxyHost

      public TcpClientConfig addNonProxyHost(String host)
      Add a host to the getNonProxyHosts() list.
      Parameters:
      host - the added host
      Returns:
      a reference to this, so the API can be used fluently
    • getLocalAddress

      public SocketAddress getLocalAddress()
      Returns:
      the local address to bind for network connections.
    • setLocalAddress

      public TcpClientConfig setLocalAddress(SocketAddress localAddress)
      Set the local address to bind for network connections. When the local address is null, it will pick any local address and a random port, the default local address is null.
      Parameters:
      localAddress - the local address
      Returns:
      a reference to this, so the API can be used fluently
    • getReconnectAttempts

      public int getReconnectAttempts()
      Returns:
      the value of reconnect attempts
    • setReconnectAttempts

      public TcpClientConfig setReconnectAttempts(int attempts)
      Set the value of reconnect attempts
      Parameters:
      attempts - the maximum number of reconnect attempts
      Returns:
      a reference to this, so the API can be used fluently
    • getReconnectInterval

      public Duration getReconnectInterval()
      Returns:
      the value of reconnect interval
    • setReconnectInterval

      public TcpClientConfig setReconnectInterval(Duration interval)
      Set the reconnect interval
      Parameters:
      interval - the reconnect interval
      Returns:
      a reference to this, so the API can be used fluently