Capture Cosmos DB Changes with Event Hubs

Capture payment changes from Cosmos DB, convert them into business events, publish them to Event Hubs, and store them for downstream analytics.
Azure • Streaming • Intermediate • Payments

Architecture Diagram

Build this project

Included in Data0to1 Project Library

What this project solves

Modern payment systems generate a continuous stream of changes.

Transactions are created, refunds are initiated, settlements are completed, and disputes are opened or resolved throughout the day. Instead of waiting for batch processing, many teams capture these changes as events so downstream systems can react faster.

In this pipeline, you will capture changes from Cosmos DB and convert them into payment business events. You will use Azure Functions to process change events, publish them to Azure Event Hubs, store the events in ADLS Gen2, and make them available for downstream processing and validation using Synapse Serverless SQL.

What you’ll build

  • Capture changes from Cosmos DB containers
  • Convert database changes into payment business events
  • Publish payment, refund, settlement, and dispute events to Event Hubs
  • Create a centralized event stream for downstream consumers
  • Track event metadata and processing information
  • Store captured events in ADLS Gen2
  • Query captured events using Synapse Serverless SQL

How you’ll build it

  • Create Cosmos DB containers for payment activity
  • Use Azure Functions to read Cosmos DB change events
  • Transform raw changes into structured business events
  • Publish events to Azure Event Hubs
  • Store and validate captured events using ADLS Gen2 and Synapse Serverless SQL

Tools you’ll use

Azure Cosmos DB • Azure Functions • Azure Event Hubs • Azure Databricks • Delta Lake • ADLS Gen2 • Synapse Serverless SQL • Python

What you’ll walk away with

After completing this pipeline, you will be able to:

  1. Explain how Cosmos DB change capture works in an Azure data platform
  2. Convert operational database changes into business events
  3. Publish event streams using Azure Event Hubs
  4. Store captured events in ADLS Gen2 for downstream processing
  5. Query and validate captured event data using Synapse Serverless SQL

Ready to build this project?

Get access to the project code, setup files, architecture walkthrough, implementation videos, and support.