use of com.azure.cosmos.models.ConflictResolutionPolicy in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class SampleDocumentationSnippets method ManageConflictResolutionPoliciesInAzureCosmosDBSprocSync.
/**
* https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-conflicts
* Resolve conflicts, stored procedure
*/
/**
* Client-side conflict resolution using stored procedure
*/
public static void ManageConflictResolutionPoliciesInAzureCosmosDBSprocSync() {
String container_id = "family_container";
String partition_key = "/pk";
CosmosDatabase database = null;
// <ManageConflictResolutionSprocSync>
ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy("resolver");
CosmosContainerProperties containerProperties = new CosmosContainerProperties(container_id, partition_key);
containerProperties.setConflictResolutionPolicy(policy);
/* ...other container config... */
database.createContainerIfNotExists(containerProperties);
// </ManageConflictResolutionSprocSync>
}
Aggregations