Page 22 - MSDN Magazine, September 2018
P. 22
AZURE
Managing Event Delivery
with Azure Event Grid
David Barkol
Event Grid is a fully managed messaging service in Microsoft Azure that provides an innovative approach for the routing of events in the cloud and beyond. It has unlocked new and unique patterns for how event-driven solutions are designed with a powerful and flexible publish-subscribe model.
I provided an introduction to Azure Event Grid in the February 2018 issue (aka.ms/eventgridarticle) that explores the fundamentals of the service and how it can be used to publish and consume events in various ways. In this new article, I’ll delve into how events are delivered and what the options are for retry policies, invalid events and events that aren’t successfully delivered. Before I dive in, it will be helpful to go over how Event Grid works at a high level.
A Brief Overview of Event Grid
With Azure Event Grid, event sources can originate from a growing list of services in Azure, such as Event Hubs and Media Services, or even from a custom application that’s running on-premises or within another cloud provider or datacenter. These events are con- sumed and managed by Event Grid, which is responsible for the ingesting of the messages and for their distribution to each event subscription. Event handlers are used to take action on incoming events and can be services in Azure. A very popular scenario is one that leverages other serverless technologies such as Functions and Logic Apps. Together, these highly scalable and flexible solutions can be composed very quickly and affordably without the burden of managing any infrastructure.
An event handler can also be a simple WebHook, which means that just like an event source, it can reside anywhere as long as it supports HTTPS and can accept a POST request. This platform- and language-agnostic approach is one of the many options that make Event Grid a very special service that has only just begun to open up new solutions in the cloud. Figure 1 illustrates how Event Grid is used to connect multiple sources and handlers. The list of services in Azure that integrate with Event Grid is constantly growing and only a subset is depicted in the diagram.
Event Delivery and Response Codes
Event Grid treats each event independently. This means that there isn’t a guaranteed order for the events and, in some cases, an event can be delivered more than once. Therefore, it’s the responsibility of the event handler to code defensively and be idempotent. Sending the
Some of the technology discussed in the article is in preview; all information is subject to change.
This article discusses:
• Event delivery and response codes • Invalid and dead letter channels
• Dead lettering with Event Grid
• Azure Functions event handler
• Subscribing to, sending and inspecting events Technologies discussed:
Microsoft Azure, Event Grid, Logic Apps, Functions
Code download available at:
bit.ly/2LGKjhN
14 msdn magazine