LiteBus
CatalogDispatch

Outbox InMemory Transport Dispatch

  • ID: dispatch.outbox.inmemory
  • Name: Outbox InMemory transport dispatch
  • Maturity: GA
  • Summary: Publish leased outbox envelopes through in-process channels for tests and local pipelines without external brokers.

What It Does

AddInMemoryTransport() registers InMemoryTransportModule at the root. UseInMemoryDispatch on OutboxModuleBuilder registers shared transport outbox dispatch as a feature bridge. This simulates broker publication for integration tests and sample multi-module hosts running in one process.

Packages

PackageRole
LiteBus.Outbox.Dispatch.InMemoryRegistration glue
LiteBus.Outbox.DispatchShared dispatcher
LiteBus.Transport.InMemoryChannel-based transport

Requires

  • dispatch.transport-core
  • transport.inmemory
  • durable-core.outbox

Invariants

  • Default hook failure policy: CompleteDespiteHookFailure.
  • Same at-least-once processor semantics as broker outbox dispatch.
  • Destination name must align with consumer/InMemory ingress configuration in tests.

Non-Goals

  • Not a production message bus.
  • Does not provide cross-process delivery.

Public Surface

services.AddLiteBus(litebus =>
{
    litebus.AddInMemoryTransport();

    litebus.AddOutbox(outbox =>
    {
        outbox.EnableOutboxProcessor();
        outbox.UseInMemoryDispatch(options =>
        {
            options.DefaultDestination = "orders.events";
        });
    });
});
APIRole
OutboxModuleBuilder.UseInMemoryDispatch(Action<TransportOutboxDispatcherOptions>? configure = null)Registers outbox transport dispatcher that requires the root in-memory transport
TransportOutboxDispatchModule.DefaultHookFailurePolicyDefaults to CompleteDespiteHookFailure
TransportOutboxDispatcher.DispatchAsync(OutboxEnvelope, CancellationToken)Shared outbox publish flow over in-process channel transport

Observability

SignalDetail
send {destination}In-memory publisher span per simulated broker send
litebus.outbox.processor.published / failedTerminal store outcomes
litebus.outbox.processor.persist_skippedRelevant when testing at-least-once republication scenarios

InMemoryOutboxAtLeastOnceIntegrationTests documents crash-between-publish-and-persist behavior at the processor layer.

Deep Docs

Test Coverage

Covered

Test methodProject
OutboxDispatchExtensions_ShouldRegisterTransportDispatcherLiteBus.Durable.IntegrationTests (Registration/)
ProcessPendingAsync_ShouldPublishEnvelopeToInMemoryDestinationLiteBus.Durable.IntegrationTests (Dispatch/Outbox/InMemory/)
ProcessPendingAsync_WhenTopicMissing_ShouldUseContractNameAsRouteLiteBus.Durable.IntegrationTests (Dispatch/Outbox/InMemory/)
ProcessPendingAsync_WhenPersistSkippedAfterPublish_ShouldRepublishOnRetryLiteBus.Durable.IntegrationTests (Dispatch/Outbox/InMemory/)

Untested

  • Hook failure path with CompleteDespiteHookFailure.
  • Tenant routing strategy and route resolver overrides.
  • Cross-process outbox to inbox topology (adapter is in-process only).

Out-of-Scope

  • Production message bus role
  • Cross-process delivery

On this page