Designing an application architecture
Choose messaging and event services, publish APIs, add caching, centralise configuration, and automate deployments.
In this lesson you'll learn
- Messages versus events, and when to use each service
- API integration with API Management
- Caching with Azure Managed Redis
- Configuration management and automated deployments
1. Messages and events
Refresher: message or event?
A message is a command or data the sender expects someone to process, such as "process order 123". An event is a notification that something happened, such as "a file was uploaded". The sender of an event doesn't care what happens next.
| Service | Type | Choose when |
|---|---|---|
| Service Bus | Messages | Enterprise messaging: ordering (sessions), transactions, duplicate detection, dead-lettering, publish-subscribe with topics |
| Queue Storage | Messages | Simple, cheap queues, very large backlogs (over 80 GB), no ordering guarantees needed |
| Event Grid | Discrete events | React to things that happened, such as a blob created or a resource deleted, with push delivery and filtering |
| Event Hubs | Event streams | Millions of telemetry events per second, replayable, Kafka-compatible |
Exam focus
Look for keywords: "first in, first out" or "transactions" means Service Bus, and "react when a blob is created" means Event Grid. "Telemetry from millions of devices" means Event Hubs, and "simple and cheapest" means Queue Storage.
2. API integration
Azure API Management sits in front of your APIs to publish, secure and manage them: authentication, rate limiting and quotas, transformation, caching, versioning, analytics and a developer portal. Choose a tier by need: Consumption (serverless), Developer (non-production), Basic, Standard and Premium, plus the v2 tiers. Premium adds multi-region deployment and full VNet injection.
3. Caching
A cache keeps frequently read data in memory, cutting database load and response times. Recommend Azure Managed Redis, which is replacing Azure Cache for Redis: it's built on Redis Enterprise and supports zone redundancy and active geo-replication. Common patterns are cache-aside for database results and storing session state. For static files, use the caching in Azure Front Door.
4. Configuration and deployment
- Azure App Configuration centralises settings and feature flags for many apps and environments, and can reference secrets stored in Key Vault.
- Key Vault holds the secrets themselves.
- Automated deployment: infrastructure as code (Bicep or Terraform) runs in pipelines with GitHub Actions or Azure DevOps. Deployment slots or revisions make releases safe, and deployment stacks manage a group of resources as one unit.
Example
An e-commerce site processes orders in strict order per customer and emails a receipt when an invoice PDF lands in storage. It also exposes partner APIs with per-partner rate limits and turns new features on gradually. The architect recommends Service Bus queues with sessions, Event Grid triggering a Function, API Management with rate-limit policies, and App Configuration feature flags.
Exam traps to remember
- Event Grid doesn't store a backlog of work for consumers to pull, but queues do.
- API Management throttles and secures APIs. A load balancer doesn't.
- For new caches, recommend Azure Managed Redis rather than Azure Cache for Redis.
- App Configuration is for settings and feature flags. Put secrets in Key Vault.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-305 Azure Solutions Architect app.
Practise in the app