In this course, we explore three Azure messaging services: Azure Event Grid, Azure Event Hubs, and Azure Service Bus, and what they are used for.
Learning Objectives
- Gain a good understanding of what these three Azure messaging services are, and how they are used.
Intended Audience
- Those who wish to learn what Azure Event Grid, Azure Event Hubs, and Azure Service Bus are, and what they are used for.
Prerequisites
- Basic familiarity with Azure
- Basic familiarity with distributed apps
Welcome to Understanding Azure Event Grid. In this lecture, we’ll take a look at Azure Event Grid. We will explore what Azure Event Grid is, what it's used for, what event sources it supports, what event handlers it supports, and the five key concepts that are essential to understanding Event Grid.
Azure Event Grid is a serverless, event broker that enables the integration of applications using events.
Azure Event Grid uses a publish-subscribe pattern that enables an event-based architecture by allowing publishers to send events to a topic in the Event Grid, and subscribers subscribe to the topic to receive the events. The Event Grid is responsible for routing the events to the appropriate subscribers based on their subscriptions. This decouples the event producer from the event consumer, making it easy to add or remove subscribers without affecting the producer, and allowing subscribers to only receive the events they are interested in.
Event Grid supports a variety of event sources. For example, you can use your own service or solution to publish events to Event Grid. Event Grid provides two resources for this purpose: Custom Topics and Domains. Use custom topics if you want to communicate system state changes and route events to event handlers of your choice. If you want to deliver events to multiple teams within a single tenant, use domains.
SaaS providers and platforms can also publish events to Event Grid through a feature called Partner Events.
Azure services such as Azure API Management, Azure App Configuration, Azure Blob Storage, and Azure Event Hubs, can also send events to Event Grid.
Event Grid supports a range of event handlers, including Webhooks, Azure Functions, Event Hubs, Service Bus Queues and Topics, Relay Hybrid Connections, and Storage Queues.
A webhook is a mechanism for receiving notifications when an event occurs. In Azure Event Grid, webhooks are used as a means to deliver events to an endpoint outside of Azure, such as a web application or a third-party service.
To use webhooks with Azure Event Grid, you first create a subscription that specifies the events you want to subscribe to and the endpoint (webhook) that should receive the events. When an event is published, Azure Event Grid sends a notification to the webhook's URL using an HTTP POST request. The notification includes a JSON payload that contains information about the event, such as its type, source, and data.
Once the webhook receives the notification, it can then process the event as needed. For example, if the event is a new file added to an Azure Storage account, the webhook can use the information in the payload to download the file and process its contents. Webhooks can be secured using authentication mechanisms such as HTTP basic authentication or OAuth 2.0. Additionally, Azure Event Grid provides retry policies and dead-lettering options to ensure reliable delivery of events to webhooks.
It’s important to note that Event Grid uses a security feature called endpoint validation, which verifies that the webhook endpoint specified by a subscriber is valid and reachable before it can receive events.
When an event subscription is created, Event Grid sends a subscription validation event to the specified endpoint, containing a validation code that the endpoint must echo back to the Event Grid service. If the validation code is not returned, Event Grid considers the endpoint invalid and does not send any events to it. This mechanism is designed to prevent unauthorized subscription creations and accidental subscriptions to incorrect endpoints. The validation process ensures that the endpoint is both reachable and authorized to receive events. Once the validation is successful, the endpoint is considered validated and ready to receive events.
Now, in addition to Webhooks, I did mention Azure Functions, Event Hubs, Service Bus Queues and Topics, Relay Hybrid Connections, and Storage Queues as supported handlers, so I don’t want to ignore them completely.
Azure Functions allow developers to run code in response to events, while Event Hubs enable real-time data streaming. Service Bus Queues and Topics provide scalable messaging.
Relay Hybrid Connections are used to securely expose services to the internet.
And Storage Queues enable asynchronous messaging.
There are five key concepts in Azure Event Grid that you need to understand in order to use it effectively: Events, Event Sources, Topics, Event Subscriptions, and Event Handlers.
-
Events are the occurrences that are happening in your system, and that you want to communicate to other applications or services.
-
Event Sources refer to where events originate. For example, a custom topic, a domain, or an Azure service.
-
A Topic is the endpoint to which publishers send events. Custom topics and domains are both examples of topics.
-
Event Subscriptions are the endpoints or built-in mechanisms that route events to event handlers. Subscriptions are also used by handlers to intelligently filter incoming events.
-
Event Handlers are the applications or services that react to the event. Examples include webhooks, Azure functions, and Event Hubs.
So, your key takeaways here should be that Event Grid is a serverless event broker that enables the integration of applications using events. The publish-subscribe pattern allows publishers to send events to a topic, and subscribers can subscribe to the topic to receive the events.
Event sources include custom topics, domains, SaaS providers, and Azure services such as Event Hubs, and event handlers include webhooks, Azure Functions, Event Hubs, Service Bus Queues and Topics, Relay Hybrid Connections, and Storage Queues.
The five key pieces that make up Azure Event Grid include Events, Event Sources, Topics, Event Subscriptions, and Event Handlers.
And Endpoint validation is used to verify that the webhook endpoint specified by a subscriber is valid and reachable before it can receive events, ensuring that the endpoint is both reachable and authorized to receive events.
Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.
In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.
In his spare time, Tom enjoys camping, fishing, and playing poker.