A .NET 9.0 console application for inspecting and monitoring Azure Service Bus queues, built with RazorConsole.
- Message Peeking: View message contents from both main queue and dead-letter queue without removing them
- Detailed Message Inspection: Interactive message viewer with full details including:
- Subject, Message ID, and Sequence Number
- Content Type and Size
- Enqueued Time
- Application Properties
- Message Body (UTF-8 text with truncation for large messages)
- Real-time Queue Metrics: Automatic polling of queue statistics with configurable refresh intervals
- Active message count (via peek-based counting)
- Dead-letter message count (via peek-based counting)
- Color-coded health indicators (green=0, yellow=1-10, orange=11-100, red=100+)
- Compact display panel showing "Main" and "DLQ" counts side-by-side
- Interactive Terminal UI:
- Rich formatting powered by Spectre.Console
- Tab-based navigation between controls
- Clickable message selection in dead-letter queue
- Split-pane view for main queue and dead-letter queue
- Single-File Deployment: Self-contained single-file executable for easy distribution and deployment
brew tap anton-kochev/tap
brew install service-bus-inspectorTo update:
brew upgrade service-bus-inspectorscoop bucket add anton-kochev https://github.com/anton-kochev/scoop-bucket
scoop install service-bus-inspectorTo update:
scoop update service-bus-inspectorcurl -fsSL https://raw.githubusercontent.com/anton-kochev/service-bus-inspector/main/install.sh | bashirm https://raw.githubusercontent.com/anton-kochev/service-bus-inspector/main/install.ps1 | iexDownload pre-built binaries for your platform from the Releases page:
- Linux: x64 (tar.gz)
- macOS: x64 (Intel), ARM64 (Apple Silicon) (tar.gz)
- Windows: x64, ARM64 (zip)
Extract the archive and run the service-bus-inspector executable directly.
service-bus-inspector --queue <queue-name> --conn "Endpoint=sb://..." --refresh-interval 5Or when running from source:
dotnet run -- --queue <queue-name> --conn "Endpoint=sb://..." --refresh-interval 5--queue- Optional. Service Bus queue name--conn- Optional. Azure Service Bus connection string--refresh-interval- Optional. Metrics refresh interval in seconds (default: 5)
Once the application is running:
- Press
Tabto navigate between buttons - Press
Enterto activate a button - Click "Peek messages" to view both main queue and dead-letter queue messages (limited to 10 messages each)
- In the dead-letter queue panel, click any message ID to view its full details in the detailed viewer
- Click "Change queue" to switch to a different queue at runtime (displays input form for new queue name)
- Click "Reset queue" twice to confirm and purge all messages from both main queue and dead-letter queue
- Press
Ctrl+Cto exit
- .NET 9.0 SDK
dotnet buildFor single-file self-contained deployment:
dotnet publish -c ReleaseThe compiled binary will be in bin/Release/net9.0/<platform>/publish/service-bus-inspector (or .exe on Windows).
Note: Binary size is approximately 70-80 MB due to self-contained deployment (includes .NET runtime).
The project includes a comprehensive GitHub Actions workflow that:
- Builds the project on Linux, Windows, and macOS in both Debug and Release configurations
- Publishes self-contained single-file binaries for 5 platforms:
- Linux: x64
- Windows: x64, ARM64
- macOS: x64 (Intel), ARM64 (Apple Silicon)
- Runs CodeQL security analysis with extended queries
- Uploads build artifacts (90-day retention)
- Automatically creates release archives and attaches them to GitHub releases
Pre-built binaries are available in the Releases section.
- .NET 9.0
- Azure.Messaging.ServiceBus 7.20.1
- RazorConsole.Core 0.1.0
- System.Text.Json 9.0.10
- Active and dead-letter counts: Calculated by peeking through messages (up to 10,000 message safety limit)
- Scheduled message count: Always shows 0 (requires ServiceBusAdministrationClient API)
- Queue size in bytes: Always shows 0 (requires ServiceBusAdministrationClient API)
- The ServiceBusAdministrationClient API is not available when using the Azure Service Bus Emulator
- Limited to 10 messages per queue (main and dead-letter) per peek operation
- Message body display is truncated to 500 characters to avoid overwhelming the terminal
- Binary message bodies cannot be displayed as text
- Reset queue: Two-click confirmation to purge all messages from both main queue and dead-letter queue
- Change queue: Runtime queue switching with input validation (displays form for entering new queue name)
- Dead-letter message management (requeue or permanently delete individual messages)
- RazorConsole: Terminal-based Razor component rendering with Blazor-like syntax
- Azure Service Bus SDK: Queue operations and message peeking via
ServiceBusClient - Spectre.Console: Rich terminal styling and colors
- PeriodicTimer: Automatic background metric refresh at configured intervals
The application follows a layered architecture with clear separation of concerns:
- MessageFormatter.cs: Pure utility functions for message formatting and body conversion
- ServiceBusInspectorState.cs: Centralized observable state with event-driven UI updates
- MessageListPanel.razor: Reusable component for displaying main queue and dead-letter queue messages
- MessageDetailsTable.razor: HTML table component showing detailed message information
- StatusMessageDisplay.razor: Color-coded status message display (warnings and success messages)
- ChangeQueueInput.razor: Queue name input form with validation and cancel button
- MetricsPanel.razor: Real-time metrics display with color-coded message counts
- ServiceBusInspectorCoordinator.cs: Orchestrates complex workflows between services and state
- ServiceBusMonitorService.cs: Service for Azure Service Bus operations with background polling
- QueueMetrics.cs: Immutable record for queue statistics
- AppOptions.cs: Configuration model for command-line arguments
- ServiceBusInspector.razor: Pure presentation markup (56 lines)
- ServiceBusInspector.razor.cs: Code-behind with component lifecycle and event handlers
- Program.cs: Application entry point with dependency injection setup
- Code-Behind Pattern: Separation between markup (.razor) and logic (.razor.cs) following Blazor best practices
- Observable State: Event-driven state management with automatic UI updates via
StateChangedevents - Dependency Injection: All components and services registered in DI container with appropriate lifetimes
- Component Composition: Reusable child components with parameter passing for data and callbacks
- Event-Driven Polling: Background metrics polling in service layer with event notifications
- Immutable Configuration: AppOptions as immutable record to prevent runtime mutations
- Thread-Safe State: Runtime state management separated from startup configuration
- Single-File Deployment: Self-contained executable with embedded .NET runtime
- The project uses
Microsoft.NET.Sdk.Razorto enable Razor component compilation - Implicit usings are disabled - all namespaces must be explicitly declared
- Message counting is performed by iterative peeking (100 messages at a time) with loop detection
The RazorConsole library uses reflection-based component activation which is incompatible with .NET Native AOT compilation. While Native AOT offers smaller binaries and faster startup, the application uses single-file self-contained deployment instead to ensure compatibility with RazorConsole. This results in larger binaries (~70-80 MB) but guarantees reliable operation across all platforms.