Table of Contents

Class OutboxBuilderPostgresExtensions

Namespace
Excalibur.Outbox.Postgres
Assembly
Excalibur.Outbox.Postgres.dll

Extension methods for configuring Postgres provider on IOutboxBuilder.

public static class OutboxBuilderPostgresExtensions
Inheritance
OutboxBuilderPostgresExtensions
Inherited Members

Remarks

These extensions provide fluent provider selection by adding provider-specific configuration to the core IOutboxBuilder interface. Connection is configured via the builder using ConnectionString(string) or ConnectionFactory(Func<IServiceProvider, IDb>).

Methods

UsePostgres(IOutboxBuilder, Action<IPostgresOutboxBuilder>)

Configures the outbox to use Postgres as the storage provider.

public static IOutboxBuilder UsePostgres(this IOutboxBuilder builder, Action<IPostgresOutboxBuilder> configure)

Parameters

builder IOutboxBuilder

The outbox builder.

configure Action<IPostgresOutboxBuilder>

Action to configure Postgres-specific options including connection.

Returns

IOutboxBuilder

The builder for fluent chaining.

Examples

// Connection string
services.AddExcalibur(x => x.AddOutbox(outbox =>
{
    outbox.UsePostgres(postgres =>
    {
        postgres.ConnectionString(connectionString)
                .SchemaName("messaging")
                .TableName("outbox_messages")
                .ReservationTimeout(TimeSpan.FromMinutes(10))
                .MaxAttempts(5);
    })
    .EnableBackgroundProcessing();
}));

// IDb factory
services.AddExcalibur(x => x.AddOutbox(outbox =>
{
    outbox.UsePostgres(postgres =>
    {
        postgres.ConnectionFactory(sp => sp.GetRequiredService<IDb>())
                .SchemaName("messaging");
    })
    .EnableBackgroundProcessing();
}));

Remarks

This is the primary method for configuring Postgres as the outbox storage provider. It registers the PostgresOutboxStore and related services. Connection can be provided via the builder using ConnectionString(string) or ConnectionFactory(Func<IServiceProvider, IDb>).

Exceptions

ArgumentNullException

Thrown when builder or configure is null.