Interface OxiaClientBuilder


public interface OxiaClientBuilder
  • Method Details

    • create

      static OxiaClientBuilder create(String serviceAddress)
      Create a new client builder.
      Parameters:
      serviceAddress - the address of the Oxia server
      Returns:
      the client builder instance
    • syncClient

      SyncOxiaClient syncClient() throws OxiaException
      Create a synchronous client.

      This method is blocking while the client initializes and talks to the server.

      Returns:
      the synchronous client instance
      Throws:
      OxiaException - if failed to create the client
    • asyncClient

      Create an asynchronous client.
      Returns:
      a future to retrieve the client instance, when ready
    • requestTimeout

      OxiaClientBuilder requestTimeout(Duration requestTimeout)
      Specify a custom timeout for all requests.

      Default is 30 secs.

      Parameters:
      requestTimeout - the timeout duration
      Returns:
      the builder instance
    • batchLinger

      OxiaClientBuilder batchLinger(Duration batchLinger)
      Specify the maximum time to wait for a batch to be sent.

      Default is 5 millis

      A larger linger time might help in creating batches with more ops in them and thus might improve the overall throughput.

      A shorter linger time might help in minimizing the latency.

      Parameters:
      batchLinger - the batch linger duration
      Returns:
      the builder instance
    • maxRequestsPerBatch

      OxiaClientBuilder maxRequestsPerBatch(int maxRequestsPerBatch)
      Specify the maximum number of requests to include in a batch.

      Default is 1000.

      Parameters:
      maxRequestsPerBatch - the maximum number of requests per batch
      Returns:
      the builder instance
    • namespace

      OxiaClientBuilder namespace(String namespace)
      Specify the Oxia namesace to use for this client instance.

      Default is "default".

      Parameters:
      namespace - the namespace to use
      Returns:
      the builder instance
    • sessionTimeout

      OxiaClientBuilder sessionTimeout(Duration sessionTimeout)
      Specify the session timeout for this client instance.

      Default is 30 secs.

      Parameters:
      sessionTimeout - the session timeout duration
      Returns:
      the builder instance
      See Also:
    • clientIdentifier

      OxiaClientBuilder clientIdentifier(String clientIdentifier)
      Specify the client identifier for this client instance.

      Default is a random UUID.

      Parameters:
      clientIdentifier - the client identifier
      Returns:
      the builder instance
      See Also:
    • clientIdentifier

      OxiaClientBuilder clientIdentifier(Supplier<String> clientIdentifier)
      Specify the client identifier for this client instance.

      Default is a random UUID.

      Parameters:
      clientIdentifier - the client identifier supplier
      Returns:
      the builder instance
      See Also:
    • openTelemetry

      OxiaClientBuilder openTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry)
      Specify the OpenTelemetry instance to use for this client instance.

      By default, the client will use the global OpenTelemetry instance if available.

      Parameters:
      openTelemetry - an OpenTelemetry instance
      Returns:
      the builder instance
    • authentication

      OxiaClientBuilder authentication(Authentication authentication)
      Configure the authentication plugin and its parameters.
      Parameters:
      authentication - the authentication instance
      Returns:
      the builder instance
    • connectionBackoff

      OxiaClientBuilder connectionBackoff(Duration minDelay, Duration maxDelay)
      Configure the connection backoff policy.

      Defaults are min=100millis, max=30sec.

      Parameters:
      minDelay - the minimum delay between retries
      maxDelay - the maximum delay between retries
      Returns:
      the builder instance
    • maxConnectionPerNode

      OxiaClientBuilder maxConnectionPerNode(int connections)
      Configure the maximum number of connections to each Oxia server node.

      Default is 1.

      Parameters:
      connections - the maximum number of connections
      Returns:
      the builder instance
    • connectionKeepAliveTimeout

      OxiaClientBuilder connectionKeepAliveTimeout(Duration connectionKeepAliveTimeout)
      Configure the keep alive timeout for the connection.

      Default is 5 sec.

      Parameters:
      connectionKeepAliveTimeout - the keep alive timeout duration
      Returns:
      the builder instance
    • connectionKeepAliveTime

      OxiaClientBuilder connectionKeepAliveTime(Duration connectionKeepAlive)
      Configure the keep alive interval for the connection.

      Default is 10 sec.

      Parameters:
      connectionKeepAlive - the keep alive interval duration
      Returns:
      the builder instance
    • authentication

      OxiaClientBuilder authentication(String authPluginClassName, String authParamsString) throws UnsupportedAuthenticationException
      Configure the authentication plugin and its parameters.
      Parameters:
      authPluginClassName - the class name of the authentication plugin
      authParamsString - the parameters of the authentication plugin
      Returns:
      the OxiaClientBuilder instance
      Throws:
      UnsupportedAuthenticationException - if the authentication plugin is not supported
    • enableTls

      OxiaClientBuilder enableTls(boolean enableTls)
      Configures whether to enable TLS (Transport Layer Security) for the client connection.
      Parameters:
      enableTls - true to enable TLS, false to disable it
      Returns:
      the builder instance for method chaining
    • loadConfig

      OxiaClientBuilder loadConfig(String configPath)
      Load the configuration from the specified configuration file.
      Parameters:
      configPath - the path of the configuration file
      Returns:
      the OxiaClientBuilder instance
    • loadConfig

      OxiaClientBuilder loadConfig(File configFile)
      Load the configuration from the specified configuration file.
      Parameters:
      configFile - the configuration file
      Returns:
      the OxiaClientBuilder instance
    • loadConfig

      OxiaClientBuilder loadConfig(Properties properties)
      Load the configuration from the specified properties.
      Parameters:
      properties - the properties
      Returns:
      the OxiaClientBuilder instance