Get startedGet started for free

Event-Driven Architectures with Event Grid

1. Event-Driven Architectures with Event Grid

Hey everyone! Let's now talk about Event driven architecture with Event Grid.

2. Introduction to Event driven architecture

Modern systems are constantly generating events, files being uploaded, data updated, users making purchases, or resources being created. Azure Event Grid makes it easy to connect these events with the right services, instantly. It's the glue that holds event-driven architectures together in Azure, helping systems react in real time instead of on a schedule.

3. Event driven architecture

We'll discuss what Azure Event Grid is and how it works. You'll learn to identify event sources and handlers, and see how Event Grid enables real-time, event-driven workflows. And you'll see how Cipher Coffee uses Event Grid to automate its operations, from marketing updates to supply alerts.

4. The challenge: Too many triggers

Think about all the moving parts in Cipher Coffee's environment. Every time a new product photo is uploaded, an order is placed, or stock levels change, those actions generate data. Without Event Grid, every app would need to constantly check for updates, a process called polling.

5. Event Grid

Polling wastes time and resources. Event Grid replaces it with real-time, push-based notifications.

6. What is Event Grid?

So what is Azure Event Grid? It is a fully managed service, that routes events from publishers to subscribers. It uses a simple publish, subscribe model. Publishers emit events like "Blob created." Subscribers, such as Functions or Logic Apps, react to those events as they happen. It's event-driven architecture, built directly into the Azure ecosystem.

7. The event workflow

Here's how it works. When a publisher, like a Storage account, generates an event, for example, when a new blob is created, Event Grid captures it and routes it to subscribers. Subscribers can be Azure Functions, Logic Apps, or even external webhooks. Each connection between a publisher and a subscriber is called an event subscription.

8. Cipher Coffee example

Let's see how Cipher Coffee uses Event Grid in action. When the marketing team uploads a new product photo to Blob Storage, Event Grid detects the Blob Created event. It triggers an Azure Function that automatically resizes the image, adds a watermark, and updates the product gallery on the website, instantly. No one needs to click anything; it just works in real time.

9. Event sources and handlers

Event Grid connects two key parts: event sources and event handlers. Sources are where events originate, like Storage accounts, Resource Groups, or IoT Hubs. Handlers are where those events are delivered, like Functions, Logic Apps, or Service Bus Topics. Event Grid handles all the routing so you don't need custom polling or scripts.

10. Event schema

Every event in Event Grid follows a standard JSON schema. Each message includes details like the event type, subject, data, and timestamp. For example, a Blob creation event might show eventType as Microsoft.Storage.BlobCreated and the blob name inside subject. These structured payloads make it easy for subscribers to process events programmatically.

11. System Events Vs Custom Events

Event Grid supports both system events and custom events. System events are built into Azure services, for example, a Blob Created event from Storage or a VM Deleted event from Compute. Custom events come from your own applications. For instance, Cipher Coffee's ordering API could publish a NewOrderCreated event that triggers a loyalty points update using a custom Event Topic. Both types follow the same pattern of publishing and subscribing.

12. Benefits of Event Grid

Event Grid offers four major advantages. First, it's serverless and scales automatically, no infrastructure to manage. Second, it ensures reliable delivery with retry policies and dead-letter queues. Third, it provides near real-time responses, events arrive within seconds. And fourth, it integrates broadly across Azure and even third-party systems.

13. Event filtering and routing

Event Grid lets you filter which events go where. You can filter by event type, for example, only send Blob Created events, or by subject pattern, like only files uploaded to an "images" container, subject paths may vary depending on API version. This keeps your system efficient by ensuring each subscriber only receives the events it needs.

14. Let's practice!

Let’s now build event automation workflows.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.