De-batch and filter serverless event processing with Event Hubs

Azure Event Hubs
Azure Functions
Azure Cosmos DB

Solution ideas

This article is a solution idea. If you'd like us to expand the content with more information, such as potential use cases, alternative services, implementation considerations, or pricing guidance, let us know by providing GitHub feedback.

This article describes a serverless event-driven architecture that uses Azure Event Hubs and Azure Functions to ingest and filter a stream of data for database storage.

Architecture

Diagram showing the data flow and key processing points in the architecture described in this article

Dataflow

  1. Events arrive at the Input Event Hub.
  2. The De-batching and Filtering Azure Function is triggered to handle the event. This step filters out unwanted events and de-batches the received events before submitting them to the Output Event Hub.
  3. If the De-batching and Filtering Azure Function fails to store the event successfully, the event is submitted to the Deadletter Event Hub 1.
  4. Events arriving at the Output Event Hub trigger the Transforming Azure Function. This Azure Function transforms the event into a message for the Azure Cosmos DB instance.
  5. The event is stored in an Azure Cosmos DB database.
  6. If the Transforming Azure Function fails to store the event successfully, the event is saved to the Deadletter Event Hub 2.

Components

  • Event Hubs ingests the data stream. Event Hubs is designed for high-throughput data streaming scenarios.
  • Azure Functions is a serverless compute option. It uses an event-driven model, where a piece of code (a function) is invoked by a trigger.
  • Azure Cosmos DB is a multi-model database service that is available in a serverless, consumption-based mode. For this scenario, the event-processing function stores JSON records, using the Azure Cosmos DB for NoSQL.

Scenario details

This solution idea describes a variation of a serverless event-driven architecture that uses Event Hubs and Azure Functions to ingest and process a stream of data. The results are written to a database for storage and future review after they're de-batched and filtered.

To learn more about the basic concepts, considerations, and approaches for serverless event processing, consult the Serverless event processing reference architecture.

Potential use cases

A popular use case for implementing an end-to-end event stream processing pattern includes the Event Hubs streaming ingestion service to receive and process events per second using a de-batching and transformation logic implemented with highly scalable, event hub-triggered functions.

Contributors

This article is maintained by Microsoft. It was originally written by the following contributors.

Principal author:

To see non-public LinkedIn profiles, sign in to LinkedIn.

Next steps