What problem does it solve?
Implements reliable, session-aware batch processing for Service Bus queues so microservices can aggregate and process related messages without overwhelming resources or duplicating work. It replaces inappropriate use of ServiceBusSessionProcessor for batching with a controlled BackgroundService pattern to ensure predictable concurrency and failure handling.
Core Features & Use Cases
- BackgroundService batch listener that accepts sessions one at a time and processes messages in groups.
- Concurrency control via SemaphoreSlim to limit simultaneous session processing.
- Manual session acceptance using AcceptNextSessionAsync and batch retrieval with ReceiveMessagesAsync.
- Deduplication by grouping messages on SourceId and keeping the first occurrence before creating a batch request.
- Batch dispatch to IMediator as a single BatchItemChanged request and coordinated complete/abandon semantics.
- Paired DLQ handler that processes dead-lettered messages individually and robust error/abandon strategies.
Quick Start
Use the batch-processing skill to implement a BackgroundService that accepts sessions with AcceptNextSessionAsync, batches messages via ReceiveMessagesAsync, deduplicates by SourceId, and sends a BatchItemChanged to IMediator while completing or abandoning messages based on processing outcome.