Summary: Learn how to combine Azure Event Hub and Service Bus for scalable, real-time event ingestion and reliable downstream processing. This post covers architecture, real-world use cases, and a hands-on demo with Azure Functions.
Integrating Azure Event Hub and Service Bus lets you build data pipelines that handle massive event volumes and guarantee delivery for critical messages. Here’s how they work together:
Combining these services gives you:
Imagine IoT sensors across a city (roads, traffic lights, emergency routes) streaming data like vehicle speed, congestion, and emergency detection into Event Hub. An Azure Function processes these events, identifies critical ones (e.g., emergency vehicles), and pushes them to a Service Bus Topic. Multiple downstream systems (emergency response, traffic control) subscribe and act in real time.
graph TD Sensors[IoT Sensors] EventHub[Azure Event Hub] Function[Azure Function] ServiceBus[Azure Service Bus Topic] Subscribers[Downstream Subscribers] Sensors -->|Telemetry| EventHub EventHub -->|Trigger| Function Function -->|Critical Events| ServiceBus ServiceBus -->|Guaranteed Delivery| Subscribers
infacto
)test-en-topic
)all
)local.settings.json
[Function("EventHubServiceBusIntegration")] public async Task<string> Run( [EventHubTrigger("infacto", Connection = "EventHubConnection")] string eventData, [ServiceBusOutput("test-en-topic", Connection = "ServiceBusConnection", EntityType = ServiceBusEntityType.Topic)] out string outputMessage, ILogger log) { log.LogInformation($"Received event: {eventData}"); // Inspect event, filter critical messages var isCritical = CheckIfCritical(eventData); outputMessage = isCritical ? eventData : null; return outputMessage; }
Legal Stuff