Skip to content
datastudyguides

AI-200 · 2.1.4 · Develop AI solutions by using Azure data management services

Cosmos change feed

Implement a change feed processor to detect and handle new or updated items

Process inserts and updates from the , checkpoint progress in leases, and design handlers for at-least-once delivery.

Pick the change feed mode

Cosmos DB change feed flow from inserted or updated items to processor instances and a lease container that stores checkpoints, with at-least-once delivery.

Latest version mode is the default. It exposes inserts and updates, keeps only the latest visible version, and does not capture deletes. All versions and deletes mode captures every change, including deletes, but needs continuous backup and has different client support.

Choose how Python consumes it

Python can use the pull model with or an Azure Functions Cosmos DB trigger. The library itself is available for .NET and Java.

changes = container.query_items_change_feed(start_time="Beginning")
for item in changes:
    handle(item)

Save the continuation token so a restarted pull consumer resumes from the same position.

Separate independent consumers

A processor or stores progress in leases. Instances with the same logical lease identity split the work. Give independent consumers different processor names, lease prefixes, or when each must see every change.

Design for retries

Delivery is at least once. Make handlers idempotent and catch item-level failures so one malformed item does not keep the same batch from checkpointing.

Key points

  • Latest version mode: inserts and updates only; deletes are not captured
  • All versions and deletes: captures every change and needs continuous backup
  • Python: pull model or Azure Functions Cosmos DB trigger
  • Checkpoint: save or lease progress
  • Independent consumers: use separate processor identity or lease prefix
  • Delivery: at least once, so handlers must tolerate duplicates

Click an underlined term for a one-line explanation, or see them all in the glossary .

Exam trap

A new processor starts at the time it first runs, not earlier; its start time is ignored once the holds state.

Sources · 4 Microsoft Learn pages Show ▾

Checked on October 4, 2026. Report a problem

Go deeper on Microsoft Learn

Checked against Microsoft Learn on October 4, 2026. Report a problem with this card

How well do you know this?