Table of Contents

Interface IOutboxProcessingBuilder

Namespace
Excalibur.Outbox
Assembly
Excalibur.Outbox.dll

Fluent builder interface for configuring outbox processing settings.

public interface IOutboxProcessingBuilder

Examples

outbox.WithProcessing(processing =>
{
    processing.BatchSize(100)
              .PollingInterval(TimeSpan.FromSeconds(5))
              .MaxRetryCount(5)
              .RetryDelay(TimeSpan.FromMinutes(1));
});

Remarks

This builder configures how messages are retrieved and processed from the outbox store. All methods return this for method chaining.

Methods

BatchSize(int)

Sets the maximum number of messages to process in a single batch.

IOutboxProcessingBuilder BatchSize(int size)

Parameters

size int

The batch size. Must be greater than 0.

Returns

IOutboxProcessingBuilder

The builder for fluent chaining.

Remarks

Larger batch sizes can improve throughput but may increase memory usage and processing time per batch. Default is 100.

Exceptions

ArgumentOutOfRangeException

Thrown when size is less than or equal to 0.

EnableParallelProcessing(int)

Enables parallel processing of messages within a batch.

IOutboxProcessingBuilder EnableParallelProcessing(int maxDegreeOfParallelism = 4)

Parameters

maxDegreeOfParallelism int

The maximum number of concurrent message processing operations. Default is 4.

Returns

IOutboxProcessingBuilder

The builder for fluent chaining.

Remarks

Parallel processing can improve throughput but may affect message ordering. Only enable if message order is not critical or if you have partitioning in place.

Exceptions

ArgumentOutOfRangeException

Thrown when maxDegreeOfParallelism is less than 1.

MaxRetryCount(int)

Sets the maximum number of retry attempts for failed messages.

IOutboxProcessingBuilder MaxRetryCount(int count)

Parameters

count int

The maximum retry count. Must be greater than or equal to 0.

Returns

IOutboxProcessingBuilder

The builder for fluent chaining.

Remarks

After the maximum retries are exhausted, messages are moved to the dead letter queue if one is configured. Default is 3.

Exceptions

ArgumentOutOfRangeException

Thrown when count is negative.

PollingInterval(TimeSpan)

Sets the interval between processing cycles.

IOutboxProcessingBuilder PollingInterval(TimeSpan interval)

Parameters

interval TimeSpan

The polling interval. Must be positive.

Returns

IOutboxProcessingBuilder

The builder for fluent chaining.

Remarks

Shorter intervals reduce latency but increase database load. Default is 5 seconds.

Exceptions

ArgumentOutOfRangeException

Thrown when interval is not positive.

ProcessorId(string)

Sets the unique identifier for this processor instance.

IOutboxProcessingBuilder ProcessorId(string processorId)

Parameters

processorId string

The processor identifier.

Returns

IOutboxProcessingBuilder

The builder for fluent chaining.

Remarks

The processor ID is used to identify which instance processed a message, useful for debugging in distributed deployments. If not set, a GUID is generated.

Exceptions

ArgumentException

Thrown when processorId is null, empty, or whitespace.

RetryDelay(TimeSpan)

Sets the delay between retry attempts.

IOutboxProcessingBuilder RetryDelay(TimeSpan delay)

Parameters

delay TimeSpan

The retry delay. Must be positive.

Returns

IOutboxProcessingBuilder

The builder for fluent chaining.

Remarks

Consider using exponential backoff for transient failures. Default is 5 minutes.

Exceptions

ArgumentOutOfRangeException

Thrown when delay is not positive.