use of com.azure.cosmos.models.ConflictResolutionPolicy in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class SalesOrder method ManageConflictResolutionPoliciesInAzureCosmosDBCustomAsync.
/**
* https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-conflicts
* Resolve conflicts, stored procedure
*/
/**
* Client-side conflict resolution with fully custom policy
*/
public static void ManageConflictResolutionPoliciesInAzureCosmosDBCustomAsync() {
String container_id = "family_container";
String partition_key = "/pk";
CosmosAsyncDatabase database = null;
// <ManageConflictResolutionCustomAsync>
ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy();
CosmosContainerProperties containerProperties = new CosmosContainerProperties(container_id, partition_key);
containerProperties.setConflictResolutionPolicy(policy);
/* ...other container config... */
database.createContainerIfNotExists(containerProperties).block();
// </ManageConflictResolutionCustomAsync>
}
use of com.azure.cosmos.models.ConflictResolutionPolicy in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class SalesOrder method ManageConflictResolutionPoliciesInAzureCosmosDBLWWAsync.
/**
* https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-conflicts
* Resolve conflicts, LWW policy
*/
/**
* Client-side conflict resolution settings for LWW policy
*/
public static void ManageConflictResolutionPoliciesInAzureCosmosDBLWWAsync() {
String container_id = "family_container";
String partition_key = "/pk";
CosmosAsyncDatabase database = null;
// <ManageConflictResolutionLWWAsync>
ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy("/myCustomId");
CosmosContainerProperties containerProperties = new CosmosContainerProperties(container_id, partition_key);
containerProperties.setConflictResolutionPolicy(policy);
/* ...other container config... */
database.createContainerIfNotExists(containerProperties).block();
// </ManageConflictResolutionLWWAsync>
}
use of com.azure.cosmos.models.ConflictResolutionPolicy in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class SalesOrder method ManageConflictResolutionPoliciesInAzureCosmosDBSprocAsync.
/**
* 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 ManageConflictResolutionPoliciesInAzureCosmosDBSprocAsync() {
String container_id = "family_container";
String partition_key = "/pk";
CosmosAsyncDatabase database = null;
// <ManageConflictResolutionSprocAsync>
ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy("resolver");
CosmosContainerProperties containerProperties = new CosmosContainerProperties(container_id, partition_key);
containerProperties.setConflictResolutionPolicy(policy);
/* ...other container config... */
database.createContainerIfNotExists(containerProperties).block();
// </ManageConflictResolutionSprocAsync>
}
use of com.azure.cosmos.models.ConflictResolutionPolicy in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class SampleDocumentationSnippets method ManageConflictResolutionPoliciesInAzureCosmosDBLWWSync.
/**
* https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-conflicts
* Resolve conflicts, LWW policy
*/
/**
* Client-side conflict resolution settings for LWW policy
*/
public static void ManageConflictResolutionPoliciesInAzureCosmosDBLWWSync() {
String container_id = "family_container";
String partition_key = "/pk";
CosmosDatabase database = null;
// <ManageConflictResolutionLWWSync>
ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy("/myCustomId");
CosmosContainerProperties containerProperties = new CosmosContainerProperties(container_id, partition_key);
containerProperties.setConflictResolutionPolicy(policy);
/* ...other container config... */
database.createContainerIfNotExists(containerProperties);
// </ManageConflictResolutionLWWSync>
}
use of com.azure.cosmos.models.ConflictResolutionPolicy in project azure-cosmos-java-sql-api-samples by Azure-Samples.
the class SampleDocumentationSnippets method ManageConflictResolutionPoliciesInAzureCosmosDBCustomSync.
/**
* https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-conflicts
* Resolve conflicts, stored procedure
*/
/**
* Client-side conflict resolution with fully custom policy
*/
public static void ManageConflictResolutionPoliciesInAzureCosmosDBCustomSync() {
String container_id = "family_container";
String partition_key = "/pk";
CosmosDatabase database = null;
// <ManageConflictResolutionCustomSync>
ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy();
CosmosContainerProperties containerProperties = new CosmosContainerProperties(container_id, partition_key);
containerProperties.setConflictResolutionPolicy(policy);
/* ...other container config... */
database.createContainerIfNotExists(containerProperties);
// </ManageConflictResolutionCustomSync>
}
Aggregations