Package com.cognite.client.config
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClientConfig.FeatureFlag
-
Constructor Summary
Constructors Constructor Description ClientConfig()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ClientConfigcreate()Returns aClientConfigobject with default settings.abstract StringgetAppIdentifier()abstract DurationgetAsyncApiJobTimeout()abstract intgetEntityMatchingMaxBatchSize()abstract ClientConfig.FeatureFlaggetExperimental()abstract intgetMaxRetries()abstract intgetNoListPartitions()abstract intgetNoTsWorkers()abstract intgetNoWorkers()abstract ProxyConfiggetProxyConfig()abstract StringgetSdkIdentifier()abstract StringgetSessionIdentifier()abstract UpsertModegetUpsertMode()ClientConfigwithAppIdentifier(String identifier)Set the app identifier.ClientConfigwithAsyncApiJobTimeout(Duration timeout)Sets the timeout for waiting for async api jobs to finish.ClientConfigwithEntityMatchingMaxBatchSize(int batchSize)Sets the max batch size when executing entity matching operations.ClientConfigwithExperimental(ClientConfig.FeatureFlag experimentalFeatures)Enable/disable experimental features.ClientConfigwithMaxRetries(int retries)Sets the maximum number of retries when sending requests to the Cognite API.ClientConfigwithNoListPartitions(int noPartitions)Specifies the number of partitions to use for (read) list requests.ClientConfigwithNoTsWorkers(int noTsWorkers)Specifies the maximum number of workers to use for the Cognite API requests towards the time series service.ClientConfigwithNoWorkers(int noWorkers)Specifies the maximum number of workers to use for the Cognite API requests.ClientConfigwithProxyConfig(ProxyConfig proxyConfig)Specifies the proxy server configuration.ClientConfigwithSessionIdentifier(String identifier)Set the session identifier.ClientConfigwithUpsertMode(UpsertMode mode)Sets the upsert mode.
-
-
-
Method Detail
-
create
public static ClientConfig create()
Returns aClientConfigobject with default settings.- Returns:
- the
ClientConfigobject.
-
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
ClientConfigwith 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
ClientConfigwith 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
ClientConfigwith 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
ClientConfigwith 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
ClientConfigwith 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
ClientConfigwith 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.UPDATEwill update the provided fields in the target object--all other fields will remain unchanged.UpsertMode.REPLACEwill replace the entire target object with the provided fields (idandexternalIdwill remain unchanged).- Parameters:
mode- the upsert mode.- Returns:
- the
ClientConfigwith 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
ClientConfigwith 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 asDuration.- Returns:
- the
ClientConfigwith 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 aProxyConfigobject with the appropriate specification.- Parameters:
proxyConfig- the proxy server configuration to use.- Returns:
- the
ClientConfigwith the setting applied. - See Also:
ProxyConfig
-
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
ClientConfigwith the setting applied.
-
-