Table of Contents

Class OutboxBuilderInMemoryExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Excalibur.Outbox.InMemory.dll

Extension methods for configuring in-memory provider on IOutboxBuilder.

public static class OutboxBuilderInMemoryExtensions
Inheritance
OutboxBuilderInMemoryExtensions
Inherited Members

Remarks

These extensions provide fluent provider selection by adding provider-specific configuration to the core IOutboxBuilder interface.

The in-memory provider is intended for testing and development scenarios only. Data is not persisted and is lost when the application restarts.

Methods

UseInMemory(IOutboxBuilder, Action<IInMemoryOutboxBuilder>?)

Configures the outbox to use in-memory storage.

public static IOutboxBuilder UseInMemory(this IOutboxBuilder builder, Action<IInMemoryOutboxBuilder>? configure = null)

Parameters

builder IOutboxBuilder

The outbox builder.

configure Action<IInMemoryOutboxBuilder>

Optional action to configure in-memory-specific options.

Returns

IOutboxBuilder

The builder for fluent chaining.

Examples

// Simple test configuration
services.AddExcalibur(x => x.AddOutbox(outbox =>
{
    outbox.UseInMemory()
          .WithProcessing(p => p.BatchSize(10));
}));

// With custom limits
services.AddExcalibur(x => x.AddOutbox(outbox =>
{
    outbox.UseInMemory(inmemory =>
    {
        inmemory.MaxMessages(100)
                .RetentionPeriod(TimeSpan.FromMinutes(5));
    });
}));

Remarks

This is the primary method for configuring in-memory as the outbox storage provider. It registers the InMemoryOutboxStore and related services.

Warning: The in-memory store is not suitable for production use. Use it only for unit tests, integration tests, or local development.

Exceptions

ArgumentNullException

Thrown when builder is null.