Share via


Azure: Serverless messaging

Introduction

Azure Event Grid, the missing piece in Serverless messaging is available as a 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 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.

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.

Azure Functions Logic Apps Service Bus Event Grid
Consumption/Price Plan Consumption Plan SKU (Basic/Standard/Premium) Consumption Plan
Billing per execution Billing per Action Billing per Operation Billing per execution
Billed based on resource consumption and executions

Execution time :

€0.000014/GB-s

Total executions:

€0.169 per million executions

First 250K :

€0.000675 / action

Price per action lowers after certain thresholds

Basic :

€0.043 per million operations

Standard :

€8.433/mo base charge

Premium :

€18.78 fixed rate per Message Unit

 €0.253 per million executions
 More info  More info  More info  More info

Note: Serverless messaging falls under the paradigm serverless computing.

Event Grid

Having explored EventGrid extensively, 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.

https://azurecomcdn.azureedge.net/mediahandler/acomblog/media/Default/blog/1f132bce-f3c0-4ba0-aa0c-9da1c32da9c1.png

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. Below you see a screenshot of a Logic App that subscribes to events from Event Hub (Prefix Filter eventhubs/issues).

https://blog.steef-jan-wiggers.com/wp-content/uploads/2017/08/Pic-1-1-1200x401.png

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 needs 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).

https://blog.steef-jan-wiggers.com/wp-content/uploads/2017/08/Pic-2-1-1200x420.png

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. 

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).

Logic App EventGrid Connector

The configuration after setting up the connection is pretty straightforward. Specify subscription, resource type (for this scenario Microsoft.EventHub.namespaces), a prefix filter for output event hub having the issues and a subscription name.

https://blog.steef-jan-wiggers.com/wp-content/uploads/2017/08/Pic-3-1.png

The configuration after setting up the connection is pretty straightforward. 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 a million euro at least. And you can do the math for Azure Function executions. Hence, compute or workflows can be expensive.

The second consideration is managing the services and operations. OMS can be a good choice as a 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

The last two days I spent hours playing around with EventGrid, formulating my thoughts around it and writing this article. 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. 

See Also

Finally, I leave you with some other press releases and Azure Friday Video: