Table of Contents

Interface IPostgresOutboxBuilder

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

Fluent builder interface for configuring Postgres-specific outbox settings.

public interface IPostgresOutboxBuilder
Extension Methods

Examples

outbox.UsePostgres(postgres =>
{
    postgres.ConnectionString(connectionString)
            .SchemaName("messaging")
            .TableName("outbox_messages")
            .CommandTimeout(TimeSpan.FromSeconds(60))
            .ReservationTimeout(TimeSpan.FromMinutes(5));
});

Remarks

This builder configures Postgres-specific options such as table names, schema, command timeouts, and reservation behavior. All methods return this for method chaining.

Methods

BindConfiguration(string)

Binds options from an IConfiguration section.

IPostgresOutboxBuilder BindConfiguration(string sectionPath)

Parameters

sectionPath string

The configuration section path.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

ConnectionFactory(Func<IServiceProvider, IDb>)

Sets a factory function that provides an IDb instance.

IPostgresOutboxBuilder ConnectionFactory(Func<IServiceProvider, IDb> dbFactory)

Parameters

dbFactory Func<IServiceProvider, IDb>

A factory function that provides an IDb instance.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

Use this for advanced scenarios like multi-database setups, custom connection pooling, or IDb integration. Mutually exclusive with ConnectionString(string). The last one set wins.

Exceptions

ArgumentNullException

Thrown when dbFactory is null.

ConnectionString(string)

Sets the connection string for the Postgres outbox database.

IPostgresOutboxBuilder ConnectionString(string connectionString)

Parameters

connectionString string

The Postgres connection string.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

This is the recommended way to provide a connection string for the outbox store. Mutually exclusive with ConnectionFactory(Func<IServiceProvider, IDb>). The last one set wins.

Exceptions

ArgumentException

Thrown when connectionString is null, empty, or whitespace.

ConnectionStringName(string)

Resolves the connection string from IConfiguration.GetConnectionString(name).

IPostgresOutboxBuilder ConnectionStringName(string name)

Parameters

name string

The connection string name.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

DataSource(NpgsqlDataSource)

Sets a pre-configured Npgsql.NpgsqlDataSource directly.

IPostgresOutboxBuilder DataSource(NpgsqlDataSource dataSource)

Parameters

dataSource NpgsqlDataSource

The Npgsql data source.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

The source is borrowed and remains owned by the caller.

DataSourceFactory(Func<IServiceProvider, NpgsqlDataSource>)

Sets a factory function that creates an Npgsql.NpgsqlDataSource.

IPostgresOutboxBuilder DataSourceFactory(Func<IServiceProvider, NpgsqlDataSource> dataSourceFactory)

Parameters

dataSourceFactory Func<IServiceProvider, NpgsqlDataSource>

A factory receiving IServiceProvider and returning an Npgsql.NpgsqlDataSource.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

The factory must create a source exclusively for this outbox registration. The container owns and disposes that source. Use DataSource(NpgsqlDataSource) to borrow a source shared with other services.

DeadLetterTableName(string)

Sets the table name for storing dead letter messages.

IPostgresOutboxBuilder DeadLetterTableName(string tableName)

Parameters

tableName string

The table name for dead letters.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

Default is "outbox_dead_letters".

Exceptions

ArgumentException

Thrown when tableName is null, empty, or whitespace.

SchemaName(string)

Sets the schema name for the outbox tables.

IPostgresOutboxBuilder SchemaName(string schema)

Parameters

schema string

The schema name (e.g., "public", "messaging").

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

Default is "public". Use this to organize outbox tables in a specific schema.

Exceptions

ArgumentException

Thrown when schema is null, empty, or whitespace.

TableName(string)

Sets the table name for storing outbox messages.

IPostgresOutboxBuilder TableName(string tableName)

Parameters

tableName string

The table name.

Returns

IPostgresOutboxBuilder

The builder for fluent chaining.

Remarks

Default is "outbox".

Exceptions

ArgumentException

Thrown when tableName is null, empty, or whitespace.