listener-pattern
CommunityOrdered, resilient Service Bus listeners
Software Engineering#dotnet#dead-letter#mediatr#serilog#service-bus#session-processor#i-hosted-service
AuthorFaysilAlshareef
Version1.0.0
Installs0
System Documentation
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.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: listener-pattern Download link: https://github.com/FaysilAlshareef/dotnet-ai-kit/archive/main.zip#listener-pattern Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.