You are developing a C# background service that processes real-time transaction updates from an Azure Cosmos DB container using the .NET SDK v3 Change Feed Processor.
You need to initialize and run the Change Feed Processor.
In which order should you execute the steps? To answer, move all actions from the list of actions to the answer area and arrange them in the correct order.
- 1Obtain `Container` references for the monitored container and the lease container using the `CosmosClient`.
- 2Call `GetChangeFeedProcessorBuilder` on the monitored container, specifying a processor name and a delegate to handle the changed documents.
- 3Chain configuration methods such as `WithLeaseContainer` and `WithInstanceName` on the builder.
- 4Call `Build` on the builder to return a `ChangeFeedProcessor` instance.
- 5Invoke `StartAsync` on the `ChangeFeedProcessor` instance to start processing notifications.
Answer
The correct sequence of steps to initialize and start the Change Feed Processor is: 1) Obtain container references; 2) Call GetChangeFeedProcessorBuilder on the monitored container; 3) Chain configuration methods; 4) Call Build to create the processor instance; and 5) Call StartAsync to start processing notifications.
To configure the Change Feed Processor, you first get references to both containers. Then, you call `GetChangeFeedProcessorBuilder` on the monitored container. Next, you configure it by chaining configuration options like the lease container and host instance name. After configuration, you build the processor, and finally, you call `StartAsync` to begin receiving change notifications.
Step-by-Step Solution
Key Concept
Initializing the Azure Cosmos DB Change Feed Processor using the .NET SDK v3.