Class DefaultCloudEventBatchProcessor
- Namespace
- Excalibur.Dispatch.CloudEvents
- Assembly
- Excalibur.Dispatch.dll
Default implementation of CloudEvent batch processor.
public sealed class DefaultCloudEventBatchProcessor : ICloudEventBatchProcessor
- Inheritance
-
DefaultCloudEventBatchProcessor
- Implements
- Inherited Members
- Extension Methods
Constructors
DefaultCloudEventBatchProcessor(CloudEventBatchOptions, IDispatcher, IServiceProvider)
Default implementation of CloudEvent batch processor.
public DefaultCloudEventBatchProcessor(CloudEventBatchOptions batchOptions, IDispatcher dispatcher, IServiceProvider serviceProvider)
Parameters
batchOptionsCloudEventBatchOptionsOptions used for batch size and thresholds.
dispatcherIDispatcherDispatch pipeline used to dispatch converted events.
serviceProviderIServiceProviderService provider used to build message contexts.
Methods
CreateBatches(IEnumerable<IDispatchEvent>, IMessageContext)
Creates batches of CloudEvents from a collection of dispatch events based on the configured batch options.
public IReadOnlyList<CloudEventBatch> CreateBatches(IEnumerable<IDispatchEvent> events, IMessageContext context)
Parameters
eventsIEnumerable<IDispatchEvent>The dispatch events to batch.
contextIMessageContextThe message context containing metadata.
Returns
- IReadOnlyList<CloudEventBatch>
A collection of CloudEvent batches ready for processing.
ProcessBatchAsync(CloudEventBatch, CancellationToken)
Processes a batch of CloudEvents by converting them back to dispatch events and dispatching them.
public Task ProcessBatchAsync(CloudEventBatch batch, CancellationToken cancellationToken)
Parameters
batchCloudEventBatchThe CloudEvent batch to process.
cancellationTokenCancellationTokenA cancellation token to cancel the operation.
Returns
- Task
A task representing the asynchronous processing operation.