Courseiva
Develop for Azure storagehardMultiple ChoiceObjective-mapped

AZ-204 Practice Question: Cosmos DB change feed processor for scalable…

An e-commerce platform writes orders to a Cosmos DB container. A downstream inventory service must process every new or updated order exactly once, even if the inventory service restarts mid-batch. The solution must scale horizontally when order volume increases. What is the recommended design?

⚠ Common exam trap

It's easy for candidates to choose Event Grid (Option C) because it is event-driven and seems simpler, but they overlook that Event Grid does not provide exactly-once processing or checkpoint-based restart resilience for Cosmos DB change feed scenarios.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use the change feed processor library with a dedicated lease container; each worker instance claims partition leases and commits checkpoints after processing each batch

The change feed processor library with a dedicated lease container is the recommended design because it provides exactly-once processing semantics through checkpointing, automatic partition lease management for horizontal scaling, and resilience to worker restarts by resuming from the last committed checkpoint. This pattern is purpose-built for Cosmos DB change feed consumption in distributed systems.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use the change feed processor library with a dedicated lease container; each worker instance claims partition leases and commits checkpoints after processing each batch

    Why this is correct

    The lease container stores the last-processed continuation token per partition. On restart, a worker reads its leases and resumes from the checkpointed position. Adding more worker instances automatically redistributes leases across instances, providing linear horizontal scaling.

  • Poll the Cosmos DB container every 30 seconds using a _ts timestamp filter to find recently modified documents

    Why it's wrong here

    Polling the Cosmos DB container using a _ts timestamp filter is an inefficient and unreliable method for change detection. This approach risks missing documents due to potential clock skew between client and server, or if multiple documents are written within the same timestamp boundary, leading to data integrity issues. Furthermore, repeatedly executing full-container scans, even with a filter, consumes significantly more Request Units (RUs) compared to the push-based change feed, leading to higher operational costs and reduced scalability for continuous monitoring.

  • Subscribe to Azure Event Grid Cosmos DB events and process them in an Azure Function

    Why it's wrong here

    Azure Event Grid does not natively emit per-document Cosmos DB change events at the document level in a way that supports the exactly-once-with-checkpoint semantics required. The change feed processor is the supported pattern for this use case.

  • Enable Cosmos DB analytical store and run batch queries from an Azure Synapse Spark pool every hour

    Why it's wrong here

    The analytical store in Azure Cosmos DB is optimized for Online Analytical Processing (OLAP) workloads, designed for large-scale aggregations and complex queries, not for transactional, near-real-time processing. Running hourly batch queries from Azure Synapse Spark introduces significant latency, making it unsuitable for an inventory service that requires immediate updates after each order write. This approach cannot provide the low-latency, event-driven responsiveness needed to maintain accurate, up-to-the-second inventory levels.

About these practice questions

One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.