Solution ideas
This article describes a solution idea. Your cloud architect can use this guidance to help visualize the major components for a typical implementation of this architecture. Use this article as a starting point to design a well-architected solution that aligns with your workload's specific requirements.
You can use Azure Functions and Azure Cosmos DB to build globally distributed, scalable serverless applications.
Architecture
Download a Visio file of this architecture.
Dataflow
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.
Components
- 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.
Scenario details
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 life cycle.
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:
- E-commerce
- Retail
- Inventory management
Next steps
- 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
Related resources
See the following architectures that include Functions and Azure Cosmos DB:
- 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
- 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: