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.
You can use Azure Functions and Azure Cosmos DB to build globally distributed, scalable serverless applications.
Download a Visio file of this architecture.
A customer places an order in an e-commerce website.
The order triggers an instance of Functions. The function processes the customer's checkout and stores information about the order in Azure Cosmos DB.
The database insert operation triggers an Azure Cosmos DB change feed event.
Systems that subscribe to change feed events are notified.
The change feed notifications trigger Functions:
- A function applies taxes to the order.
- A function processes payment for the order.
- A function fulfills the order.
- Functions is an event-driven serverless compute platform. With Functions, you can use triggers and bindings to integrate services at scale.
- Azure Cosmos DB is a globally distributed, multi-model database. With Azure Cosmos DB, your solutions can elastically scale throughput and storage across any number of geographic regions.
Microservices offer many benefits:
- They provide highly scalable solutions.
- You can deploy each service independently.
- Fault isolation is straightforward when you confine functionality to separate containers.
- They fit well in a DevOps environment.
- They decrease time to market by speeding up the software development lifecycle.
An efficient way to implement microservices is to use a serverless technology. This solution uses Functions, an Azure offering that provides a serverless compute experience. The solution uses Azure Cosmos DB for data storage. Azure Cosmos DB offers a change feed that integrates with Functions.
Potential use cases
This solution applies to many areas:
- Inventory management
- Introduction to Azure Functions
- Welcome to Azure Cosmos DB
- Change feed in Azure Cosmos DB
- Create a function triggered by Azure Cosmos DB
- Connect Azure Functions to Azure Cosmos DB using Visual Studio Code
See the following architectures that include Functions and Azure Cosmos DB:
- Azure Cosmos DB in IoT workloads
- Transactional Outbox pattern with Azure Cosmos DB
- Gaming using Azure Cosmos DB
- Code walkthrough: Serverless application with Functions
- Analyze news feeds with near real-time analytics using image and natural language processing
See the following architectures that feature Functions:
- Integrate Event Hubs with serverless functions on Azure
- Azure Functions in a hybrid environment
- Monitor Azure Functions and Event Hubs
- Azure App Service and Azure Functions considerations for multitenancy
- Performance and scale for Event Hubs and Azure Functions
See the following architectures that feature Azure Cosmos DB: