Class CloudEventsPipelineExtensions
- Namespace
- Microsoft.Extensions.DependencyInjection
- Assembly
- Excalibur.Dispatch.dll
Extension methods for adding CloudEvents middleware to the dispatch pipeline.
public static class CloudEventsPipelineExtensions
- Inheritance
-
CloudEventsPipelineExtensions
- Inherited Members
Methods
UseCloudEventBatching(IDispatchBuilder, Action<CloudEventBatchOptions>?)
Adds CloudEvent batching support to the dispatch pipeline.
public static IDispatchBuilder UseCloudEventBatching(this IDispatchBuilder builder, Action<CloudEventBatchOptions>? configureBatch = null)
Parameters
builderIDispatchBuilderThe dispatch builder.
configureBatchAction<CloudEventBatchOptions>Optional action to configure batch options.
Returns
- IDispatchBuilder
The builder for fluent configuration.
Remarks
This method registers CloudEvent batching services via
CloudEventBatchOptions configuration.
Batching groups multiple CloudEvents together for efficient processing.
UseCloudEventTransformation(IDispatchBuilder, Func<CloudEvent, IDispatchEvent, IMessageContext, CancellationToken, Task>)
Adds custom CloudEvent transformation for outgoing events to the dispatch pipeline.
public static IDispatchBuilder UseCloudEventTransformation(this IDispatchBuilder builder, Func<CloudEvent, IDispatchEvent, IMessageContext, CancellationToken, Task> transformer)
Parameters
builderIDispatchBuilderThe dispatch builder.
transformerFunc<CloudEvent, IDispatchEvent, IMessageContext, CancellationToken, Task>A function that transforms a CloudEvent before it is sent. Multiple transformers are chained in registration order.
Returns
- IDispatchBuilder
The builder for fluent configuration.
Remarks
This method registers a custom CloudEvent transformer via
CloudEventOptions.Schema.OutgoingTransformer configuration.
Transformers are applied to outgoing CloudEvents in the order they were registered.
UseCloudEventValidation(IDispatchBuilder, Func<CloudEvent, CancellationToken, Task<bool>>)
Adds custom CloudEvent validation to the dispatch pipeline.
public static IDispatchBuilder UseCloudEventValidation(this IDispatchBuilder builder, Func<CloudEvent, CancellationToken, Task<bool>> validator)
Parameters
builderIDispatchBuilderThe dispatch builder.
validatorFunc<CloudEvent, CancellationToken, Task<bool>>A function that validates a CloudEvent and returns true if the event is valid, or false to reject it.
Returns
- IDispatchBuilder
The builder for fluent configuration.
Remarks
This method registers a custom CloudEvent validator via
CloudEventOptions.Schema.CustomValidator.
The validator is invoked for each incoming CloudEvent before handler execution.
UseCloudEvents(IDispatchBuilder)
Adds CloudEvents middleware to the dispatch pipeline.
public static IDispatchBuilder UseCloudEvents(this IDispatchBuilder builder)
Parameters
builderIDispatchBuilderThe dispatch builder.
Returns
- IDispatchBuilder
The builder for fluent configuration.
Remarks
The CloudEvents middleware enriches messages with CloudEvents metadata (source, type, subject, etc.) following the CloudEvents specification.
CloudEvents options must be configured separately via IOptions<CloudEventOptions>.
This method only adds the middleware to the pipeline.
Recommended pipeline order:
builder.UseCloudEvents() // Enrich early so downstream middleware sees CE metadata
.UseAuthentication()
.UseAuthorization()
.UseValidation()
.UseOutbox();