Package io.unlaunch

Interface UnlaunchClientBuilder


public interface UnlaunchClientBuilder
This builder class contains configuration required by Unlaunch client.

Implementations of this interface are mutable hence not thread-safe.

Author:
umermansoor
  • Method Details

    • build

    • sdkKey

      UnlaunchClientBuilder sdkKey​(java.lang.String sdkKey)
    • offlineMode

      UnlaunchClientBuilder offlineMode()
      This is intended for testing purposes. Starts the client is offline mode. All flag evaluations will return
      control
      variation and no data is sent to server.

      For more information read this.

      Returns:
    • offlineModeWithLocalFeatures

      UnlaunchClientBuilder offlineModeWithLocalFeatures​(java.lang.String yamlFeaturesFilePath)
      This is intended for testing, including unit testing. This allows you to pass a YAML file containing feature flags and the variations to return when they are evaluated. You can also control dynamic configuration and specify which values to return.

      For more information and a template,read this

      Parameters:
      yamlFeaturesFilePath -
      Returns:
    • pollingInterval

      UnlaunchClientBuilder pollingInterval​(long interval, java.util.concurrent.TimeUnit unit)
      This is for controlling how often the SDK download flags from the servers if the data has changed.

      The default interval is 60 seconds for production, and 20 seconds for non-production environments.

      Parameters:
      interval -
      unit -
      Returns:
      UnlaunchClientBuilder
    • connectionTimeout

      UnlaunchClientBuilder connectionTimeout​(long timeout, java.util.concurrent.TimeUnit unit)
      Sets the default connect timeout for HTTP connections.

      This is the time to establish the connection with remote Unlaunch servers.

      The default value is 10 seconds. The minimum value allowed is 1 second.

      Parameters:
      timeout -
      unit -
      Returns:
      UnlaunchClientBuilder
    • readTimeout

      UnlaunchClientBuilder readTimeout​(long timeout, java.util.concurrent.TimeUnit unit)
      Sets the default read timeout for HTTP connections.

      Specifies the time to wait for data to arrive after establishing the connection.

      The default value is 10 seconds. The minimum value allowed is 1 second.

      Parameters:
      timeout -
      unit -
      Returns:
      UnlaunchClientBuilder
    • host

      UnlaunchClientBuilder host​(java.lang.String host)
      Unlaunch server to connect to for downloading feature flags, submitting events, etc.

      Use this if you are running Unlaunch backend service on-premise or are enterprise customer. The default value is https://api.unlaunch.io

      Parameters:
      host - - Unlaunch backend service to connect to
      Returns:
      UnlaunchClientBuilder
    • metricsFlushInterval

      UnlaunchClientBuilder metricsFlushInterval​(long interval, java.util.concurrent.TimeUnit unit)
      The SDK periodically sends events like metrics and diagnostics data to our servers. This controls how frequently this data is sent.

      When the SDK is shutdown using the UnlaunchClient.shutdown(), all buffered data is automatically sent.

      The default value is 30 seconds for production and 10 seconds for non-production environments.

      Parameters:
      interval -
      unit -
      Returns:
      UnlaunchClientBuilder
    • eventsFlushInterval

      UnlaunchClientBuilder eventsFlushInterval​(long interval, java.util.concurrent.TimeUnit unit)
      This controls how frequently tracking events are sent to the server.

      When the SDK is shutdown using the UnlaunchClient.shutdown(), all buffered data is automatically sent.

      The default value is 60 seconds for production and 15 seconds for non-production environments.

      Parameters:
      interval -
      unit -
      Returns:
      UnlaunchClientBuilder
    • eventsQueueSize

      UnlaunchClientBuilder eventsQueueSize​(int maxQueueSize)
      The maximum number of events to keep in memory.

      Events are sent to the server when either the queue size or events flush interval is reached, whichever comes first.

      Parameters:
      maxQueueSize -
      Returns:
      UnlaunchClientBuilder
    • metricsQueueSize

      UnlaunchClientBuilder metricsQueueSize​(int maxQueueSize)
      The maximum number of metrics (impressions) to keep in memory.

      Metrics are sent to the server when either the queue size or the flush interval is reached, whichever comes first.

      Parameters:
      maxQueueSize -
      Returns:
      UnlaunchClientBuilder
    • enableLazyLoading

      UnlaunchClientBuilder enableLazyLoading()