How to use Azure Cosmos DB change feed with Azure Functions (original) (raw)

APPLIES TO: NoSQL

Azure Functions provides the simplest way to connect to the change feed. You can create small reactive Azure Functions that will be automatically triggered on each new event in your Azure Cosmos DB container's change feed.

Serverless event-based Functions working with the Azure Functions trigger for Azure Cosmos DB

With the Azure Functions trigger for Azure Cosmos DB, you can leverage the Change Feed Processor's scaling and reliable event detection functionality without the need to maintain any worker infrastructure. Just focus on your Azure Function's logic without worrying about the rest of the event-sourcing pipeline. You can even mix the Trigger with any other Azure Functions bindings.

Note

The Azure Functions trigger uses latest version change feed mode. Currently, the Azure Functions trigger for Azure Cosmos DB is supported for use with the API for NoSQL only.

Requirements

To implement a serverless event-based flow, you need:

Create your Azure Functions trigger for Azure Cosmos DB

Creating your Azure Function with an Azure Functions trigger for Azure Cosmos DB is now supported across all Azure Functions IDE and CLI integrations:

Run your trigger locally

You can run your Azure Function locally with the Azure Cosmos DB Emulator to create and develop your serverless event-based flows without an Azure Subscription or incurring any costs.

If you want to test live scenarios in the cloud, you can Try Azure Cosmos DB for free without any credit card or Azure subscription required.

Next steps

You can now continue to learn more about change feed in the following articles: