Table of Contents

Interface IOutboxBuilder

Namespace
Excalibur.Outbox
Assembly
Excalibur.Outbox.dll

Fluent builder interface for configuring Excalibur Outbox.

public interface IOutboxBuilder
Extension Methods

Examples

services.AddExcalibur(x => x.AddOutbox(outbox =>
{
    outbox.UseSqlServer(sql =>
    {
        sql.ConnectionString("Server=.;Database=MyDb;Trusted_Connection=True;")
           .SchemaName("Outbox")
           .TableName("Messages")
           .CommandTimeout(TimeSpan.FromSeconds(30))
           .UseRowLocking(true);
    })
    .WithProcessing(processing =>
    {
        processing.BatchSize(100)
                  .PollingInterval(TimeSpan.FromSeconds(5))
                  .MaxRetryCount(5)
                  .RetryDelay(TimeSpan.FromMinutes(1));
    })
    .EnableBackgroundProcessing();
}));

Remarks

This interface follows the Microsoft-style fluent builder pattern. It provides the single entry point for Outbox configuration.

All methods return this for method chaining, enabling a fluent configuration experience.

Properties

Services

Gets the service collection being configured.

IServiceCollection Services { get; }

Property Value

IServiceCollection

The IServiceCollection.

Methods

EnableBackgroundProcessing()

Enables background processing of outbox messages.

IOutboxBuilder EnableBackgroundProcessing()

Returns

IOutboxBuilder

The builder for fluent chaining.

Examples

outbox.UseSqlServer(sql => sql.ConnectionString("Server=.;Database=MyDb;Trusted_Connection=True;"))
      .EnableBackgroundProcessing();

Remarks

When enabled, a hosted service will be registered that periodically polls the outbox and publishes pending messages to their configured transports.

For serverless scenarios where background services are not suitable, omit this call and use IOutboxProcessor directly.

WithProcessing(Action<IOutboxProcessingBuilder>)

Configures outbox processing settings using a fluent builder.

IOutboxBuilder WithProcessing(Action<IOutboxProcessingBuilder> configure)

Parameters

configure Action<IOutboxProcessingBuilder>

The processing configuration action.

Returns

IOutboxBuilder

The builder for fluent chaining.

Examples

outbox.WithProcessing(processing =>
{
    processing.BatchSize(100)
              .PollingInterval(TimeSpan.FromSeconds(5))
              .MaxRetryCount(5)
              .RetryDelay(TimeSpan.FromMinutes(1))
              .ProcessorId("instance-1")
              .EnableParallelProcessing(4);
});

Remarks

Use this method to configure how messages are processed from the outbox, including batch sizes, polling intervals, and retry behavior.

Exceptions

ArgumentNullException

Thrown when configure is null.