Introducing .NET Aspire Event Hub Live Explorer
Authored by LupusOnFire, this article introduces the .NET Aspire Event Hub Live Explorer—an open-source Blazor tool for local development with Azure Event Hubs.
Introducing .NET Aspire Event Hub Live Explorer
Author: LupusOnFire
While migrating Azure projects to .NET Aspire to improve local development, LupusOnFire encountered the recurring need to publish events to locally emulated Azure Event Hubs in order to emulate and trigger event-driven workflows.
Because Azure Event Hub Explorer is unavailable for local environments, an initial workaround—a minimal console application—was functional but inefficient for frequent use. To address this, LupusOnFire developed Event Hub Live Explorer, an open-source, Blazor-based frontend for Azure Event Hubs.
Repository: https://github.com/lupusbytes/event-hub-live-explorer
What is Event Hub Live Explorer?
Event Hub Live Explorer provides a streamlined UI for interacting with Azure Event Hubs, supporting both sending and receiving events in real time. It is designed for:
- Local development
- Testing
- Diagnostics
Event Hub Live Explorer is built to integrate smoothly into .NET Aspire dashboards, enhancing the developer experience and reducing setup friction for event-driven system development.
Features
- Send messages directly to Event Hubs
- Read events from multiple partitions in real time
- Integrates with .NET Aspire
- Ideal for local development and testing of event-based systems
Usage in .NET Aspire
Prerequisites
Installation and Setup
-
Add the NuGet package to your Aspire AppHost project:
dotnet add package LupusBytes.Aspire.Hosting.Azure.EventHubs.LiveExplorer
-
Add Event Hub Live Explorer to your Aspire Dashboard:
var explorer = builder.AddEventHubLiveExplorer();
-
Reference an Event Hub:
var eventHub = builder .AddAzureEventHubs("event-hub-namespace").RunAsEmulator() .AddEventHub("event-hub"); explorer.WithReference(eventHub);
This will enable the Explorer to connect using the
$Default
consumer group. -
Use a Different Consumer Group:
var eventHubWithCustomConsumerGroup = eventHub.AddConsumerGroup("explorer"); explorer.WithReference(eventHubWithCustomConsumerGroup);
-
Add All Event Hubs Automatically: Use the convenience method to reduce boilerplate by referencing all added Event Hubs and creating consumer groups if needed:
builder .AddAzureEventHubs("event-hub-namespace").RunAsEmulator() .AddEventHub("event-hub1") .AddEventHub("event-hub2") .AddEventHub("event-hub3") .AddEventHub("event-hub4"); explorer.WithAutoReferences(consumerGroupName: "explorer");
Note: This must be called after all desired Event Hubs have been added. Event Hubs added after this call will not be referenced.
More Information
- For documentation, usage samples, and contribution guidelines, see the project repository: https://github.com/lupusbytes/event-hub-live-explorer
This post appeared first on “Reddit DotNet”. Read the entire article here