Table of Contents

Class BatchingPipelineExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Excalibur.Dispatch.dll

Extension methods for adding batching middleware to the dispatch pipeline.

public static class BatchingPipelineExtensions
Inheritance
BatchingPipelineExtensions
Inherited Members

Methods

UseBatching(IDispatchBuilder)

Adds message batching middleware to the dispatch pipeline.

public static IDispatchBuilder UseBatching(this IDispatchBuilder builder)

Parameters

builder IDispatchBuilder

The dispatch builder.

Returns

IDispatchBuilder

The builder for fluent configuration.

Remarks

The batching middleware groups multiple messages together and dispatches them as a batch, improving throughput for high-volume scenarios.

Batching is configured through UnifiedBatchingOptions, set the usual way — services.Configure<UnifiedBatchingOptions>(...) or a bound configuration section. Calling this method also registers validation for those options, so a non-positive batch size, delay, or degree of parallelism fails at host start rather than degrading silently once messages begin to flow.

Recommended pipeline order:

builder.UseAuthentication()
       .UseAuthorization()
       .UseValidation()
       .UseBatching()             // Batch after validation
       .UseTransaction();