Azure Event Grid, the missing piece in Serverless messaging is available as preview in Microsoft Azure. Serverless messaging means you can build a messaging solution in Azure leveraging Service Bus, Logic Apps, Functions, and Event Grid. “In Azure Event Grid, all events are emitted from topics”, said Dan Rosanova, Principal program manager Lead from the Service Bus team in the InfoQ article Microsoft Ships Azure Event Grid for Unified Event Processing. He was the Product owner of this new service. With Event Grid as a kind of Event Broker any application can push events to an Event Topic and any or multiple subscribers can have events pushed to them. Service Bus provides brokering messages, Logic Apps provide connectivity (175 + connectors) and flow of steps, and functions execution of small pieces of code. Each a Platform services, where servers are abstracted away, (auto) scale, and cost are consumption based. Therefore, each service supports messaging by itself or can be combined with the other for a richer messaging experience.
Serverless messaging capability
To conclude serverless messaging capability, in Azure consists of:
- Azure Functions – Serverless compute
- Logic Apps – Serverless connectivity and workflows
- Service Bus – Serverless messaging
- Event Grid – Serverless Events
The pricing is per execution, action, or operation, see table below.
Note: Serverless messaging is part of the paradigm of serverless computing. Tracing messages and Azure Service Bus monitoring across multiple Queues and Topic Subscriptions provide powerful toolsets and actionable insights to troubleshoot messaging issues.
Event Grid
In a previous post I discussed EventGrid a bit and tried to understand the capabilities. Having explored a bit more I am starting to see it’s potential. It is still early days as the service is in preview and needs to evolve a bit more. EventGrid can handle multiple publishers and subscribers (event handlers) and sits a mediator between them. Hence there decoupled and have no dependencies with other.
EventGrid itself provides intelligent routing by having filters defined directly based on prefix and suffix. However, the filtering can be done for instance in Logic App, where you specify your trigger. Regardless Event Grid will provide the routing. Moreover, below you see a screenshot of a Logic App that subscribes to events from Event Hub (Prefix Filter eventhubs/issues).
Scenario IOT Milk Production
Serverless messaging services in Azure fit in various scenarios, where messages play an essential role. For instance, in IOT scenario’s. Consider a fully automated farm with milk cows. Each cow has a device and need to be milked every 6 hours or so. The milking is done through a milking robot. And cow will be made aware when she is due to be milked. Once the cow has been milked the data is pushed by milkrobot to IOT Hub and subsequently ingested by an event hub. The event hub is an input stream for a Stream Analytics Job. And another event hub is an output for issues, while the data is also streamed towards blob storage for further analysis later. The Event Hub to receive any issues regarding milk data pushes the message to event grid with a Logic App as a subscriber. The Logic App on its turn can send a notification to the farm and perform other steps (flow).
As you can see in the diagram above, there are several azure components, and basically all are serverless. Some messaging related, hence serverless messaging like Event Grid, and Logic App.
Azure EventGrid connector
Logic App can subscribe to events via Event Grid Connector, which currently only supports one trigger operation : when a resource event occurs. Therefore, you can at the start, add this trigger action and configure it using a service principal (it will not work with an MSDN account I have learned from Jeff Hollan).
The configuration after setting up the connection is pretty straight forward. Specify subscription, resource type (for this scenario Microsoft.EventHub.namespaces), a prefix filter for output event hub having the issues and a subscription name.
Subscribers
The Logic App will send a notification to the farmer and/or perform other steps. The event can be processed in various ways. Moreover, multiple Logic Apps and/or Functions can handle the event each in its own manner. One to many, many to one or many to many can be supported by Event Grid with no dependencies. And this is one of the huge benefits of Event Grid. Once the more services are on board for Event Grid this will become evident.
Considerations
Serverless messaging has some considerations you need to take into account. First and foremost the workload for your services. Event Grid is cheap, 253 euro for a billion executions. However, if a billion executions result in two or more billion Logic App actions will be over ten thousands of euro’s at least. And you can do the math for Azure Function executions. Hence, compute or workflows can be expensive.
Second consideration is managing the services and operations. OMS can be a good choice as service to have a good overview of each. It has solutions for Logic Apps (Preview), and such. Or you could leverage the Power BI Solution Template for Azure Activity Log Analytics. However, it will be quite a challenge to have a good overview of the services and a capability to resubmit messages for instance. Read Saravana’s latest article on LinkedIn : Challenges Managing Distributed Cloud Applications.
Finally another consideration regarding this solution is connectivity with devices (cow/milk robot) and ingesting the messages/events via IOT Hub, securing the devices and traffic. Yet this is at the start/beginning of this scenario and less related to serverless computing/messaging. See Sam VanHoutte’s presentation : Integration of things; building on Azure IoT for industrial IoT solutions!
Conclusion
To conclude, the last two days I spend hours playing around with EventGrid, formulating my thoughts around it and writing this blog post. As described in the beginning the service is at its early stages (preview), however the reception so far has been good. And other Product Groups like the Pro Integration PG at Microsoft are huge fans. Jeff Hollan created a great channel9 video: Azure Serverless end-to-end with Functions, Logic Apps, and Event Grid and article for medium.com. Some of the other Azure Integration MVP’s written some blogs like Edert’s Creating event driven integrations using Azure Event Grid. His blog post and Jeff’s video were an inspiration for this blog post.
If you like to explore this technology, check out the resource links here and the documentation. You’ll find some tutorials there, reference documentation and quick starts. And I believe the number of resources will grow over time.
Finally, I like to leave you with some other press releases and Azure Friday Video:
- com – How Azure Event Grid Can Become The Foundation Of Microsoft Serverless Strategy
- com – Microsoft launches Azure Event Grid, a fully managed event routing service
- zd.net – Microsoft takes the wraps off new Azure Event Grid service
- Channel9 – Azure Event Grid