Class ClientConfig

java.lang.Object
com.cognite.client.config.ClientConfig
All Implemented Interfaces:
Serializable

public abstract class ClientConfig extends Object implements Serializable
This class captures the client configuration parameters.
See Also:
  • Constructor Details

    • ClientConfig

      public ClientConfig()
  • Method Details

    • create

      public static ClientConfig create()
      Returns a ClientConfig object with default settings.
      Returns:
      the ClientConfig object.
    • getSdkIdentifier

      public abstract String getSdkIdentifier()
    • getAppIdentifier

      public abstract String getAppIdentifier()
    • getSessionIdentifier

      public abstract String getSessionIdentifier()
    • getMaxRetries

      public abstract int getMaxRetries()
    • getNoWorkers

      public abstract int getNoWorkers()
    • getNoTsWorkers

      public abstract int getNoTsWorkers()
    • getNoListPartitions

      public abstract int getNoListPartitions()
    • getUpsertMode

      public abstract UpsertMode getUpsertMode()
    • getEntityMatchingMaxBatchSize

      public abstract int getEntityMatchingMaxBatchSize()
    • getAsyncApiJobTimeout

      public abstract Duration getAsyncApiJobTimeout()
    • getProxyConfig

      @Nullable public abstract ProxyConfig getProxyConfig()
    • getExperimental

      public abstract ClientConfig.FeatureFlag getExperimental()
    • withAppIdentifier

      public ClientConfig withAppIdentifier(String identifier)
      Set the app identifier. The identifier is encoded in the api calls to the Cognite instance and can be used for tracing and statistics.
      Parameters:
      identifier - the application identifier.
      Returns:
      the ClientConfig with the setting applied.
    • withSessionIdentifier

      public ClientConfig withSessionIdentifier(String identifier)
      Set the session identifier. The identifier is encoded in the api calls to the Cognite instance and can be used for tracing and statistics.
      Parameters:
      identifier - the session identifier.
      Returns:
      the ClientConfig with the setting applied.
    • withMaxRetries

      public ClientConfig withMaxRetries(int retries)
      Sets the maximum number of retries when sending requests to the Cognite API. The default setting is 5. This should be sufficient for most scenarios.
      Parameters:
      retries - the maximum number of retries before failing a request.
      Returns:
      the ClientConfig with the setting applied.
    • withNoWorkers

      public ClientConfig withNoWorkers(int noWorkers)
      Specifies the maximum number of workers to use for the Cognite API requests. The default setting is eight workers.
      Parameters:
      noWorkers - max number of workers.
      Returns:
      the ClientConfig with the setting applied.
    • withNoListPartitions

      public ClientConfig withNoListPartitions(int noPartitions)
      Specifies the number of partitions to use for (read) list requests. This represents the number of parallel streams to use for reading the results of list requests. The default setting is eight partitions.
      Parameters:
      noPartitions - the number of partitions for list requests.
      Returns:
      the ClientConfig with the setting applied.
    • withNoTsWorkers

      public ClientConfig withNoTsWorkers(int noTsWorkers)
      Specifies the maximum number of workers to use for the Cognite API requests towards the time series service. This is a high-capacity service optimized for a higher number of workers than the other API services. The default setting is 16 workers.
      Parameters:
      noTsWorkers - max number of workers.
      Returns:
      the ClientConfig with the setting applied.
    • withUpsertMode

      public ClientConfig withUpsertMode(UpsertMode mode)
      Sets the upsert mode. When the data object to write does not exist, the writer will always create it. But, if the object already exist, the writer can update the the existing object in one of two ways: update or replace. UpsertMode.UPDATE will update the provided fields in the target object--all other fields will remain unchanged. UpsertMode.REPLACE will replace the entire target object with the provided fields (id and externalId will remain unchanged).
      Parameters:
      mode - the upsert mode.
      Returns:
      the ClientConfig with the setting applied
    • withEntityMatchingMaxBatchSize

      public ClientConfig withEntityMatchingMaxBatchSize(int batchSize)
      Sets the max batch size when executing entity matching operations.
      Parameters:
      batchSize - the max batch size.
      Returns:
      the ClientConfig with the setting applied.
    • withAsyncApiJobTimeout

      public ClientConfig withAsyncApiJobTimeout(Duration timeout)
      Sets the timeout for waiting for async api jobs to finish. Async api jobs includes the CDF context api endpoints like entity matching and engineering diagram parsing. The default timeout is 20 minutes.
      Parameters:
      timeout - The async timeout expressed as Duration.
      Returns:
      the ClientConfig with the setting applied.
    • withProxyConfig

      public ClientConfig withProxyConfig(ProxyConfig proxyConfig)
      Specifies the proxy server configuration. The default setting is no proxy server configuration. If you need to specify a proxy server configuration, you supply a ProxyConfig object with the appropriate specification.
      Parameters:
      proxyConfig - the proxy server configuration to use.
      Returns:
      the ClientConfig with the setting applied.
      See Also:
    • withExperimental

      public ClientConfig withExperimental(ClientConfig.FeatureFlag experimentalFeatures)
      Enable/disable experimental features. Experimental features are not fully tested and does not offer future compatibility guarantees.
      Parameters:
      experimentalFeatures - the experimental feature flags.
      Returns:
      the ClientConfig with the setting applied.