@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") public final class ChangeFeedPolicy extends Object
The example below creates a new container with a change feed policy for full fidelity change feed with a retention window of 8 minutes - so intermediary snapshots of changes as well as deleted documents would be available for processing for 8 minutes before they vanish. Processing the change feed with full fidelity mode will only be able within this retention window - if you attempt to process a change feed after more than the retention window (8 minutes in this sample) an error (Status Code 400) will be returned. It would still be possible to process changes using Incremental mode even when configuring a full fidelity change feed policy with retention window on the container and when using Incremental mode it doesn't matter whether your are out of the retention window or not.
CosmosContainerProperties containerProperties =
new CosmosContainerProperties("ContainerName", "/somePartitionKeyProperty");
containerProperties.setChangeFeedPolicy(ChangeFeedPolicy.createFullFidelityPolicy(8));
CosmosAsyncDatabase database = client.createDatabase(databaseProperties).block().getDatabase();
CosmosAsyncContainer container = database.createContainer(containerProperties).block().getContainer();
The example below creates a new container with a change feed policy for incremental change feed. Processing the change feed with full fidelity mode will not be possible for this container. It would still be possible to process changes using Incremental mode. The Incremental change feed policy is also the default that is used when not explicitly specifying a change feed policy.
CosmosContainerProperties containerProperties =
new CosmosContainerProperties("ContainerName", "/somePartitionKeyProperty");
containerProperties.setChangeFeedPolicy(ChangeFeedPolicy.createIncrementalPolicy());
CosmosAsyncDatabase database = client.createDatabase(databaseProperties).block().getDatabase();
CosmosAsyncContainer container = database.createContainer(containerProperties).block().getContainer();
Modifier and Type | Method and Description |
---|---|
static ChangeFeedPolicy |
createFullFidelityPolicy(Duration retentionDuration)
Creates a ChangeFeedPolicy with retention duration for full fidelity processing
|
static ChangeFeedPolicy |
createIncrementalPolicy()
Creates a default ChangeFeedPolicy without retention duration specified.
|
Duration |
getFullFidelityRetentionDuration()
Gets the retention duration in which it will be possible to
process change feed events with full fidelity mode (meaning intermediary changes and deletes
will be exposed in change feed).
|
@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") public static ChangeFeedPolicy createFullFidelityPolicy(Duration retentionDuration)
retentionDuration
- - the retention duration (max granularity in minutes) in which it
will be possible to process change feed events with full fidelity
mode (meaning intermediary changes and deletes
will be exposed in change feed).@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") public static ChangeFeedPolicy createIncrementalPolicy()
This is the default policy being used when not specifying any ChangeFeedPolicy for the Container.
@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") public Duration getFullFidelityRetentionDuration()
Copyright © 2021 Microsoft Corporation. All rights reserved.