Azure Event Hubs
This is part 3 in my blog series on Azure Event Grid. Part 1 and Part 2.
One of the great new stories in Microsoft Azure’s Event lineup of products and features is Azure Event Hubs, which is Microsoft’s highly scalable data streaming platform and event ingestion service built on top of the AMQP 1.0 protocol. Event Hubs allows for the processing of millions of events per second at a highly affordable cost. Current offerings price out to 2.8 cents per million events.
What exactly are Event Hubs and how do they work? A good place to start is a diagram from the Azure Event Hubs overview
Fig. 1 Azure Event Hubs – Event ingestor architecture
In a microservices architecture, Event Hubs can play an important role as the “front door” for data. Data can originate from many Event Producers such as a website, a mobile application, IoT applications, or smaller devices that consume low power and can be connected off and on.
This data can be collected by cloud gateways such as API’s – restful interfaces exposed in the cloud to applications reaching out with appropriate credentials. It can also be collected by field gateways – one example is for cars. Data from a car’s computer ECU can be transmitted via bluetooth by way of a plug-in OBD2 device, which can be collected by way of an Android or iPhone cellular phone equipped with a Bluetooth receiver dongle. This can then be transmitted to the cloud via a cellular network. This would be an example of the Field gateway architecture on the above diagram.
AMQP 1.0 Protocol
Azure Event Hubs, and the entire eventing architecture including the event grid and on to all the subscribers receiving event notifications all are built upon the Advanced Message Queueing Protocol 1.0 (AMQP 1.0). This standard was constructed as an extremely lightweight messaging protocol (more lightweight than https) that supports advanced security standards like TLS encryption and batching of messages (http does not). Because of this construction, Event Hubs are valuable in very high volume scenarios such as online gaming, large websites, and power grid telemetry.
Azure Event Grid
In this blog series I am focusing on the Microsoft Azure Event Grid and where it relates as a new preview Azure feature offering in the event driven programming and architecture. In Fig 1 above, after the Event Hub receives the data from its originator, and passes it along, when the data payload is stored in short-term blob storage, an event is raised. This can be seen a little more clearly in Fig 2 below from Azure Event Grid overview:
Fig 2 – Azure Event Grid cycle
As we see in the above diagram, Event Hubs originate the event, the Event Grid (middle image) receives the event through a topic subscription, and passes it along to Event Handlers on the back end. In a microservices application architecture, we would use both Azure Functions and Logic Apps as a back end processor to facilitate workflow and integration with other cloud services.
In the next article we will build an example both in code and in the Azure portal.