Class CosmosDbConfiguration
- java.lang.Object
-
- org.apache.camel.component.azure.cosmosdb.CosmosDbConfiguration
-
-
Constructor Summary
Constructors Constructor Description CosmosDbConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CosmosDbConfigurationcopy()StringgetAccountKey()Sets either a master or readonly key used to perform authentication for accessing resource.com.azure.cosmos.models.ChangeFeedProcessorOptionsgetChangeFeedProcessorOptions()Sets theChangeFeedProcessorOptionsto be used.com.azure.cosmos.ConsistencyLevelgetConsistencyLevel()Sets the consistency levels supported for Azure Cosmos DB client operations in the Azure Cosmos DB service.StringgetContainerName()The name of the Cosmos container that component should connect to.StringgetContainerPartitionKeyPath()Sets the container partition key path.com.azure.cosmos.CosmosAsyncClientgetCosmosAsyncClient()Inject an externalCosmosAsyncClientinto the component which provides a client-side logical representation of the Azure Cosmos DB service.StringgetDatabaseEndpoint()Sets the Azure Cosmos database endpoint the component will connect to.StringgetDatabaseName()The name of the Cosmos database that component should connect to.StringgetHostName()Sets the hostname.StringgetItemId()Sets the itemId in case needed for operation on item like delete, replaceStringgetItemPartitionKey()Sets partition key.StringgetLeaseContainerName()Sets the lease container which acts as a state storage and coordinates processing the change feed across multiple workers.StringgetLeaseDatabaseName()Sets the lease database where theleaseContainerNamewill be stored.CosmosDbOperationsDefinitiongetOperation()The CosmosDB operation that can be used with this component on the producer.StringgetPreferredRegions()Sets the comma separated preferred regions for geo-replicated database accounts.StringgetQuery()An SQL query to execute on a given resources.com.azure.cosmos.models.CosmosQueryRequestOptionsgetQueryRequestOptions()Set additional QueryRequestOptions that can be used with queryItems, queryContainers, queryDatabases, listDatabases, listItems, listContainers operationscom.azure.cosmos.models.ThroughputPropertiesgetThroughputProperties()Sets throughput of the resources in the Azure Cosmos DB service.booleanisClientTelemetryEnabled()Sets the flag to enable client telemetry which will periodically collect database operations aggregation statistics, system information like cpu/memory and send it to cosmos monitoring service, which will be helpful during debugging.booleanisConnectionSharingAcrossClientsEnabled()Enables connections sharing across multiple Cosmos Clients.booleanisContentResponseOnWriteEnabled()Sets the boolean to only return the headers and status code in Cosmos DB response in case of Create, Update and Delete operations on CosmosItem.booleanisCreateContainerIfNotExists()Sets if the component should create Cosmos container automatically in case it doesn't exist in Cosmos databasebooleanisCreateDatabaseIfNotExists()Sets if the component should create Cosmos database automatically in case it doesn't exist in Cosmos accountbooleanisCreateLeaseContainerIfNotExists()Sets if the component should create Cosmos lease container for the consumer automatically in case it doesn't exist in Cosmos databasebooleanisCreateLeaseDatabaseIfNotExists()Sets if the component should create Cosmos lease database for the consumer automatically in case it doesn't exist in Cosmos accountbooleanisMultipleWriteRegionsEnabled()Sets the flag to enable writes on any regions for geo-replicated database accounts in the Azure Cosmos DB service.booleanisReadRequestsFallbackEnabled()Sets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service.booleanisUseDefaultIdentity()Indicates whether to use the default identity mechanism instead of the access key.voidsetAccountKey(String accountKey)voidsetChangeFeedProcessorOptions(com.azure.cosmos.models.ChangeFeedProcessorOptions changeFeedProcessorOptions)voidsetClientTelemetryEnabled(boolean clientTelemetryEnabled)voidsetConnectionSharingAcrossClientsEnabled(boolean connectionSharingAcrossClientsEnabled)voidsetConsistencyLevel(com.azure.cosmos.ConsistencyLevel consistencyLevel)voidsetContainerName(String containerName)voidsetContainerPartitionKeyPath(String containerPartitionKeyPath)voidsetContentResponseOnWriteEnabled(boolean contentResponseOnWriteEnabled)voidsetCosmosAsyncClient(com.azure.cosmos.CosmosAsyncClient cosmosAsyncClient)voidsetCreateContainerIfNotExists(boolean createContainerIfNotExists)voidsetCreateDatabaseIfNotExists(boolean createDatabaseIfNotExists)voidsetCreateLeaseContainerIfNotExists(boolean createLeaseContainerIfNotExists)voidsetCreateLeaseDatabaseIfNotExists(boolean createLeaseDatabaseIfNotExists)voidsetDatabaseEndpoint(String databaseEndpoint)voidsetDatabaseName(String databaseName)voidsetHostName(String hostName)voidsetItemId(String itemId)voidsetItemPartitionKey(String itemPartitionKey)voidsetLeaseContainerName(String leaseContainerName)voidsetLeaseDatabaseName(String leaseDatabaseName)voidsetMultipleWriteRegionsEnabled(boolean multipleWriteRegionsEnabled)voidsetOperation(CosmosDbOperationsDefinition operation)voidsetPreferredRegions(String preferredRegions)voidsetQuery(String query)voidsetQueryRequestOptions(com.azure.cosmos.models.CosmosQueryRequestOptions queryRequestOptions)voidsetReadRequestsFallbackEnabled(boolean readRequestsFallbackEnabled)voidsetThroughputProperties(com.azure.cosmos.models.ThroughputProperties throughputProperties)voidsetUseDefaultIdentity(boolean useDefaultIdentity)
-
-
-
Method Detail
-
getDatabaseName
public String getDatabaseName()
The name of the Cosmos database that component should connect to. In case you are producing data and have createDatabaseIfNotExists=true, the component will automatically auto create a Cosmos database.
-
setDatabaseName
public void setDatabaseName(String databaseName)
-
getContainerName
public String getContainerName()
The name of the Cosmos container that component should connect to. In case you are producing data and have createContainerIfNotExists=true, the component will automatically auto create a Cosmos container.
-
setContainerName
public void setContainerName(String containerName)
-
getAccountKey
public String getAccountKey()
Sets either a master or readonly key used to perform authentication for accessing resource.
-
setAccountKey
public void setAccountKey(String accountKey)
-
isUseDefaultIdentity
public boolean isUseDefaultIdentity()
Indicates whether to use the default identity mechanism instead of the access key.
-
setUseDefaultIdentity
public void setUseDefaultIdentity(boolean useDefaultIdentity)
-
getDatabaseEndpoint
public String getDatabaseEndpoint()
Sets the Azure Cosmos database endpoint the component will connect to.
-
setDatabaseEndpoint
public void setDatabaseEndpoint(String databaseEndpoint)
-
getContainerPartitionKeyPath
public String getContainerPartitionKeyPath()
Sets the container partition key path.
-
setContainerPartitionKeyPath
public void setContainerPartitionKeyPath(String containerPartitionKeyPath)
-
getItemPartitionKey
public String getItemPartitionKey()
Sets partition key. Represents a partition key value in the Azure Cosmos DB database service. A partition key identifies the partition where the item is stored in.
-
setItemPartitionKey
public void setItemPartitionKey(String itemPartitionKey)
-
getItemId
public String getItemId()
Sets the itemId in case needed for operation on item like delete, replace
-
setItemId
public void setItemId(String itemId)
-
isCreateDatabaseIfNotExists
public boolean isCreateDatabaseIfNotExists()
Sets if the component should create Cosmos database automatically in case it doesn't exist in Cosmos account
-
setCreateDatabaseIfNotExists
public void setCreateDatabaseIfNotExists(boolean createDatabaseIfNotExists)
-
isCreateContainerIfNotExists
public boolean isCreateContainerIfNotExists()
Sets if the component should create Cosmos container automatically in case it doesn't exist in Cosmos database
-
setCreateContainerIfNotExists
public void setCreateContainerIfNotExists(boolean createContainerIfNotExists)
-
isCreateLeaseDatabaseIfNotExists
public boolean isCreateLeaseDatabaseIfNotExists()
Sets if the component should create Cosmos lease database for the consumer automatically in case it doesn't exist in Cosmos account
-
setCreateLeaseDatabaseIfNotExists
public void setCreateLeaseDatabaseIfNotExists(boolean createLeaseDatabaseIfNotExists)
-
isCreateLeaseContainerIfNotExists
public boolean isCreateLeaseContainerIfNotExists()
Sets if the component should create Cosmos lease container for the consumer automatically in case it doesn't exist in Cosmos database
-
setCreateLeaseContainerIfNotExists
public void setCreateLeaseContainerIfNotExists(boolean createLeaseContainerIfNotExists)
-
getCosmosAsyncClient
public com.azure.cosmos.CosmosAsyncClient getCosmosAsyncClient()
Inject an externalCosmosAsyncClientinto the component which provides a client-side logical representation of the Azure Cosmos DB service. This asynchronous client is used to configure and execute requests against the service.
-
setCosmosAsyncClient
public void setCosmosAsyncClient(com.azure.cosmos.CosmosAsyncClient cosmosAsyncClient)
-
getQueryRequestOptions
public com.azure.cosmos.models.CosmosQueryRequestOptions getQueryRequestOptions()
Set additional QueryRequestOptions that can be used with queryItems, queryContainers, queryDatabases, listDatabases, listItems, listContainers operations
-
setQueryRequestOptions
public void setQueryRequestOptions(com.azure.cosmos.models.CosmosQueryRequestOptions queryRequestOptions)
-
getConsistencyLevel
public com.azure.cosmos.ConsistencyLevel getConsistencyLevel()
Sets the consistency levels supported for Azure Cosmos DB client operations in the Azure Cosmos DB service.The requested ConsistencyLevel must match or be weaker than that provisioned for the database account. Consistency levels by order of strength are STRONG, BOUNDED_STALENESS, SESSION and EVENTUAL. Refer to consistency level documentation for additional details: https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels
-
setConsistencyLevel
public void setConsistencyLevel(com.azure.cosmos.ConsistencyLevel consistencyLevel)
-
getPreferredRegions
public String getPreferredRegions()
Sets the comma separated preferred regions for geo-replicated database accounts. For example, "East US" as the preferred region.When EnableEndpointDiscovery is true and PreferredRegions is non-empty, the SDK will prefer to use the regions in the container in the order they are specified to perform operations.
-
setPreferredRegions
public void setPreferredRegions(String preferredRegions)
-
isClientTelemetryEnabled
public boolean isClientTelemetryEnabled()
Sets the flag to enable client telemetry which will periodically collect database operations aggregation statistics, system information like cpu/memory and send it to cosmos monitoring service, which will be helpful during debugging.DEFAULT value is false indicating this is opt in feature, by default no telemetry collection.
-
setClientTelemetryEnabled
public void setClientTelemetryEnabled(boolean clientTelemetryEnabled)
-
isConnectionSharingAcrossClientsEnabled
public boolean isConnectionSharingAcrossClientsEnabled()
Enables connections sharing across multiple Cosmos Clients. The default is false. When you have multiple instances of Cosmos Client in the same JVM interacting to multiple Cosmos accounts, enabling this allows connection sharing in Direct mode if possible between instances of Cosmos Client. Please note, when setting this option, the connection configuration (e.g., socket timeout config, idle timeout config) of the first instantiated client will be used for all other client instances.
-
setConnectionSharingAcrossClientsEnabled
public void setConnectionSharingAcrossClientsEnabled(boolean connectionSharingAcrossClientsEnabled)
-
isMultipleWriteRegionsEnabled
public boolean isMultipleWriteRegionsEnabled()
Sets the flag to enable writes on any regions for geo-replicated database accounts in the Azure Cosmos DB service.When the value of this property is true, the SDK will direct write operations to available writable regions of geo-replicated database account. Writable regions are ordered by PreferredRegions property. Setting the property value to true has no effect until EnableMultipleWriteRegions in DatabaseAccount is also set to true.
DEFAULT value is true indicating that writes are directed to available writable regions of geo-replicated database account.
-
setMultipleWriteRegionsEnabled
public void setMultipleWriteRegionsEnabled(boolean multipleWriteRegionsEnabled)
-
isReadRequestsFallbackEnabled
public boolean isReadRequestsFallbackEnabled()
Sets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service.DEFAULT value is true.
If this property is not set, the default is true for all Consistency Levels other than Bounded Staleness, The default is false for Bounded Staleness. 1.
#endpointDiscoveryEnabledis true 2. the Azure Cosmos DB account has more than one region
-
setReadRequestsFallbackEnabled
public void setReadRequestsFallbackEnabled(boolean readRequestsFallbackEnabled)
-
getQuery
public String getQuery()
An SQL query to execute on a given resources. To learn more about Cosmos SQL API, check this link {@link https://docs.microsoft.com/en-us/azure/cosmos-db/sql-query-getting-started}
-
setQuery
public void setQuery(String query)
-
getThroughputProperties
public com.azure.cosmos.models.ThroughputProperties getThroughputProperties()
Sets throughput of the resources in the Azure Cosmos DB service.
-
setThroughputProperties
public void setThroughputProperties(com.azure.cosmos.models.ThroughputProperties throughputProperties)
-
isContentResponseOnWriteEnabled
public boolean isContentResponseOnWriteEnabled()
Sets the boolean to only return the headers and status code in Cosmos DB response in case of Create, Update and Delete operations on CosmosItem. In Consumer, it is enabled by default because of the ChangeFeed in the consumer that needs this flag to be enabled and thus is shouldn't be overridden. In Producer, it advised to disable it since it reduces the network overhead
-
setContentResponseOnWriteEnabled
public void setContentResponseOnWriteEnabled(boolean contentResponseOnWriteEnabled)
-
getLeaseContainerName
public String getLeaseContainerName()
Sets the lease container which acts as a state storage and coordinates processing the change feed across multiple workers. The lease container can be stored in the same account as the monitored container or in a separate account. It will be auto created ifcreateLeaseContainerIfNotExistsis set to true.
-
setLeaseContainerName
public void setLeaseContainerName(String leaseContainerName)
-
getLeaseDatabaseName
public String getLeaseDatabaseName()
Sets the lease database where theleaseContainerNamewill be stored. If it is not specified, this component will store the lease container in the same database that is specified indatabaseName. It will be auto created ifcreateLeaseDatabaseIfNotExistsis set to true.
-
setLeaseDatabaseName
public void setLeaseDatabaseName(String leaseDatabaseName)
-
getHostName
public String getHostName()
Sets the hostname. The host: a host is an application instance that uses the change feed processor to listen for changes. Multiple instances with the same lease configuration can run in parallel, but each instance should have a different instance name. If not specified, this will be a generated random hostname.
-
setHostName
public void setHostName(String hostName)
-
getChangeFeedProcessorOptions
public com.azure.cosmos.models.ChangeFeedProcessorOptions getChangeFeedProcessorOptions()
Sets theChangeFeedProcessorOptionsto be used. Unless specifically set the default values that will be used are:- maximum items per page or FeedResponse: 100
- lease renew interval: 17 seconds
- lease acquire interval: 13 seconds
- lease expiration interval: 60 seconds
- feed poll delay: 5 seconds
- maximum scale count: unlimited
-
setChangeFeedProcessorOptions
public void setChangeFeedProcessorOptions(com.azure.cosmos.models.ChangeFeedProcessorOptions changeFeedProcessorOptions)
-
getOperation
public CosmosDbOperationsDefinition getOperation()
The CosmosDB operation that can be used with this component on the producer.
-
setOperation
public void setOperation(CosmosDbOperationsDefinition operation)
-
copy
public CosmosDbConfiguration copy()
-
-