Package com.azure.spring.data.cosmos
Class CosmosFactory
java.lang.Object
com.azure.spring.data.cosmos.CosmosFactory
Factory class for CosmosDb to create client
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCosmosFactory
(com.azure.cosmos.CosmosAsyncClient cosmosAsyncClient, String databaseName) Validate config and initialization -
Method Summary
Modifier and TypeMethodDescriptionstatic com.azure.cosmos.CosmosAsyncClient
createCosmosAsyncClient
(com.azure.cosmos.CosmosClientBuilder cosmosClientBuilder) Create Cosmos Async Clientcom.azure.cosmos.CosmosAsyncClient
To create a CosmosAsyncClientGet Cosmos Database NameThis returns container name for each operation.
-
Field Details
-
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
Validate config and initialization- Parameters:
cosmosAsyncClient
- cosmosAsyncClientdatabaseName
- databaseName
-
-
Method Details
-
getCosmosAsyncClient
public com.azure.cosmos.CosmosAsyncClient getCosmosAsyncClient()To create a CosmosAsyncClient- Returns:
- CosmosAsyncClient
-
getDatabaseName
Get Cosmos Database Name- Returns:
- Cosmos Database Name
-
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:
- container name
-
createCosmosAsyncClient
public static com.azure.cosmos.CosmosAsyncClient createCosmosAsyncClient(com.azure.cosmos.CosmosClientBuilder cosmosClientBuilder) Create Cosmos Async Client- Parameters:
cosmosClientBuilder
- CosmosClientBuilder- Returns:
- CosmosAsyncClient
-