What problem does it solve?
Provides a consistent, production-ready pattern for building Service Bus session-based listeners as hosted services so messages are processed in aggregate-ordered fashion and dead letters are handled reliably.
Core Features & Use Cases
- Session-based ordering: Uses a ServiceBusSessionProcessor configured for strict per-session ordering and high parallelism across sessions.
- DLQ pairing: Includes a paired dead-letter processor to reprocess messages from the dead letter queue with the same routing logic.
- Typed handling and dispatch: Performs typed deserialization, subject-based routing to generic handlers, and MediatR dispatch within a scoped service provider while using explicit Complete/Abandon semantics and Serilog enrichment.
- Use Case: Implement an OrdersListener that processes OrderCreated and OrderUpdated events per aggregate session, completes successful handlers, and reprocesses dead letters with conservative concurrency.
Quick Start
Create an IHostedService that constructs a ServiceBusSessionProcessor and a paired dead-letter ServiceBusProcessor, configure AutoCompleteMessages=false and PrefetchCount=1, implement subject-based routing to typed handlers, and register the listener as a hosted service.