CosmosFactory Class
- java.
lang. Object - com.
azure. spring. data. cosmos. CosmosFactory
- com.
public class CosmosFactory
Factory class for CosmosDb to create client
Field Summary
Modifier and Type | Field and Description |
---|---|
protected String |
databaseName
Database Name to be used for operations. |
Constructor Summary
Constructor | Description |
---|---|
CosmosFactory(CosmosAsyncClient cosmosAsyncClient, String databaseName) |
Validate config and initialization |
Method Summary
Modifier and Type | Method and Description |
---|---|
static
Cosmos |
createCosmosAsyncClient(CosmosClientBuilder cosmosClientBuilder)
Create Cosmos Async Client |
Cosmos |
getCosmosAsyncClient()
To create a Cosmos |
String |
getDatabaseName()
Get Cosmos Database Name |
String |
overrideContainerName()
This returns container name for each operation. |
Methods inherited from java.lang.Object
Field Details
databaseName
protected String databaseName
Database Name to be used for operations. This is not practically tied to CosmosFactory instance. This can be updated even for same cosmosAsyncClient.
Constructor Details
CosmosFactory
public CosmosFactory(CosmosAsyncClient cosmosAsyncClient, String databaseName)
Validate config and initialization
Parameters:
Method Details
createCosmosAsyncClient
public static CosmosAsyncClient createCosmosAsyncClient(CosmosClientBuilder cosmosClientBuilder)
Create Cosmos Async Client
Parameters:
Returns:
getCosmosAsyncClient
public CosmosAsyncClient getCosmosAsyncClient()
To create a CosmosAsyncClient
Returns:
getDatabaseName
public String getDatabaseName()
Get Cosmos Database Name
Returns:
overrideContainerName
public String overrideContainerName()
This returns container name for each operation. By default, container name will be derived from entity definition. NOTE: Using this API will override container name defined on entity definition.
Returns:
Applies to
Azure SDK for Java