Authors: Gouri Bodade & Muthukrishnan P
Table of Contents
- Introduction to Azure Event Hub
- Basic Elements of Azure Event Hub
- Software Versions used in this Demo
- Download Azure Event Hub
- Create MuleSoft Publish Flow
Introduction to Azure Event Hub
Azure Event Hub is a big data streaming platform and event ingestion service. It can receive and process millions of events per second. Data sent to an Event Hub can be transformed and stored by using any real-time analytics provider or batching/storage adapters.
The key features of Azure Event Hub are as follows:
- Fully Managed PaaS
- Rich ecosystem
- Capture Event data
- Support for real-time and batch processing
Basic Elements of Azure Event Hub
- Event producers: Any entity that sends data to an Event Hub. Event publishers can publish events using HTTPS or AMQP 1.0 or Apache Kafka (1.0 and above).
- Partitions: Each consumer only reads a specific subset, or partition, of the message stream.
- Consumer groups: A view (state, position, or offset) of an entire Event Hub. Consumer groups enable consuming applications each to have a separate view of the event stream. They read the stream independently at their own pace and with their own offsets.
- Throughput units (standard tier) or processing units (premium tier) or capacity units (dedicated): Pre-purchased units of capacity that control the throughput capacity of Event Hubs.
- Event receivers: Any entity that reads event data from an Event Hub. All Event Hubs consumers connect via the AMQP 1.0 session. The Event Hubs service delivers events through a session as they become available. All Kafka consumers connect via the Kafka protocol 1.0 and later.
Software Versions used in this Demo
- Java 1.8
- Mule Runtime 4.3.0 EE
- Anypoint Studio 7.12
- Azure Event Hub Connector — Mule 4 version 4.4.0
- Windows 10
Create an Event Hub using the Azure portal
- Here is the reference for Creating Azure Event Hub:
Download Azure Event Hub
- For integrating Mule and Azure Event Hub in Anypoint Studio, download the Azure service bus connector from Anypoint Exchange.
- In Mule Palette the Azure Event Hub connector is downloaded with its required operations.
- For sending the data to a particular Event Hub, the “Send” operation is used, with the configurations, destination name, body, required access key, and service namespace which is shown below.
Create MuleSoft publish flow
Let us now integrate Azure Event Hub with Mule 4
Create a new project, a simple flow, and set all the configurations as follows:
- Listener configuration
- Set Payload
It contains a particular message which we have to send over to the Event Hub.
- Azure Event Hub Send Connector
It sends the data to a particular Event Hub Namespace which is provided in the configuration properties.
Now run the application and hit the request from the postman.
We can observe the set payload message in Postman.
The same message is routed to the destination Event Hub namespace and we can observe the statistics of the data.