Question

Difficulty: MediumProcess Azure Cosmos DB Change Feed Notifications

You are developing a background service in C# that uses the Azure Cosmos DB .NET SDK v3 Change Feed Processor to process document updates from a monitored container. Which of the following statements correctly describes the configuration or behavior of the Change Feed Processor?

  1. The lease container must be partitioned using /id/id, and if the change feed delegate throws an unhandled exception, the processor will continuously retry processing the failed batch of changes.Answer
  2. B
    The lease container must be partitioned using the same partition key as the monitored container to ensure processing leases are colocated with the source data.
  3. C
    The Change Feed Processor requires that the monitored container be set to Session consistency; otherwise, the processor will skip notifications for writes that occur across different client sessions.
  4. D
    The lease documents are stored as blobs in Azure Blob Storage, and you must use the Azure Storage SDK within the delegate to manually acquire and release leases.

Answer

The lease container must be partitioned using /id/id, and if the change feed delegate throws an unhandled exception, the processor will continuously retry processing the failed batch of changes.
The correct option correctly states that the lease container must be partitioned by /id/id. Furthermore, when an unhandled exception is thrown in the change feed delegate, the Change Feed Processor will continuously retry the same batch of changes. This guarantees at-least-once processing but requires developers to implement robust try-catch blocks to prevent processing from getting stuck.

Step-by-Step Solution

1
Configure the lease container with the correct partition key.
The lease container is created with a partition key of /id/id, allowing the Change Feed Processor to successfully distribute partition leases.
The Change Feed Processor stores lease state as individual documents in the lease container. The partition key /id/id ensures efficient state distribution and access.
2
Implement the change feed handler delegate and handle exceptions.
Uncaught exceptions within the delegate cause the Change Feed Processor to retry the same batch of changes indefinitely.
The processor only updates the continuation token in the lease container when the delegate completes successfully. To prevent partition blockage, developers must implement exception handling (such as a try-catch block) within the delegate.

Key Concept

Azure Cosmos DB Change Feed Processor Configuration and Error Handling
Estimated Time:1m 30s
Rate this question