You are developing a .NET background service using the Azure Cosmos DB .NET SDK v3. The service uses the Change Feed Processor to monitor product catalog updates in a source container and synchronize them to an Azure Cognitive Search index. You need to provision a new lease container in Azure Cosmos DB to store the state of the Change Feed Processor. Which partition key path must you define when creating the lease container to ensure the Change Feed Processor can initialize and run?
- A/leaseId
- B/productId (or matching the partition key of the monitored catalog container)
- /idAnswer
- D/partitionKey
Answer
The lease container must be created with the partition key path set to /id.
The correct answer is to use the /id partition key path. In the Azure Cosmos DB .NET SDK v3, the Change Feed Processor relies on a lease container partitioned specifically by /id. This layout allows the processor to acquire, renew, and distribute leases for different partition key ranges of the monitored container to one or more processing hosts.
Step-by-Step Solution
Key Concept
Lease container partition key requirements for the Azure Cosmos DB Change Feed Processor