LiteBus
CatalogDurable core

Operations and Management

  • ID: durable-core.operations-management
  • Name: Operations and Management
  • Maturity: GA
  • Summary: Provides typed inbox and outbox management, retention, processor control, diagnostics, and optional ASP.NET Core routes.

What It Does

IInboxManager and IOutboxManager expose operator operations without exposing storage adapter types. Each manager delegates to the operations and retention roles implemented by the selected store.

Processor controls are separate contracts. IInboxProcessorControl and IOutboxProcessorControl pause leasing, resume work, report state, and run a bounded drain pass. Hosts can use these contracts directly or expose them through LiteBus.Extensions.AspNetCore.

Manager API

OperationInboxOutboxBehavior
QueryIInboxManager.QueryAsyncIOutboxManager.QueryAsyncApplies typed filters and keyset pagination
Get by identifierGetMessageAsyncGetMessageAsyncReturns one envelope or null
Requeue selectedRequeueAsyncRequeueAsyncReturns requested and requeued counts
Requeue dead lettersRequeueDeadLettersAsyncRequeueDeadLettersAsyncReads and requeues in pages of 200
PurgePurgeAsyncPurgeAsyncRequires confirmation for an unrestricted filter
Status countsGetStatusCountsAsyncGetStatusCountsAsyncGroups current rows by durable status
Schema informationGetSchemaInfoAsyncGetSchemaInfoAsyncReturns logical or physical schema metadata
Retention statusGetRetentionStatusAsyncGetRetentionStatusAsyncReturns the latest run outcome
Run retentionRunRetentionPurgeAsyncRunRetentionPurgeAsyncDeletes terminal rows older than the configured retention period

Query and purge APIs accept InboxMessageFilter or OutboxMessageFilter. Filters can select identifiers, statuses, contract names, trace fields, tenants, and creation-time bounds. Page requests use opaque keyset cursors returned by the previous page.

Processor Control

ContractMethodsState Values
IInboxProcessorControlPauseAsync, ResumeAsync, DrainAsyncRunning, paused, draining
IOutboxProcessorControlPauseAsync, ResumeAsync, DrainAsyncRunning, paused, draining

Pause waits for the active pass before blocking new leases. Resume opens the processor gate. Drain processes currently available work once and then stops new passes, subject to a caller-supplied timeout.

Retention

Inbox retention deletes completed rows. Outbox retention deletes published rows. The corresponding cleanup host options select the retention period and background loop interval. A null or non-positive retention period disables deletion while leaving status inspection available.

Each manager records the latest retention run timestamp, deleted-row count, and failure message through its retention coordinator. Manual and hosted retention use the same coordinator state.

HTTP Adapter

LiteBus.Extensions.AspNetCore maps manager and processor-control contracts under a configurable prefix:

builder.Services.AddLiteBusManagement(options =>
{
    options.AuthorizationPolicy = "LiteBusOperator";
});

app.AddLiteBusManagementEndpoints();

The default prefix is /litebus. Inbox and outbox route groups are independent. A missing manager produces HTTP 404 for its entire axis. See ASP.NET Core Management Endpoints for the route table and authorization behavior.

Packages

PackageRole
LiteBus.Inbox.AbstractionsInbox manager, filters, pages, receipts, processor control
LiteBus.InboxDefault inbox manager and retention coordinator
LiteBus.Outbox.AbstractionsOutbox manager, filters, pages, receipts, processor control
LiteBus.OutboxDefault outbox manager and retention coordinator
LiteBus.Extensions.AspNetCoreOptional HTTP binding
LiteBus.Extensions.Diagnostics.HealthChecksASP.NET Core health-check bridge for manifest diagnostics

Requires

  • One inbox or outbox storage adapter that implements the matching operations roles.
  • Processor registration for pause, resume, state, or drain operations.
  • Cleanup host registration only when periodic retention is required.

Safety Rules

  • Unrestricted purge requires explicit confirmation.
  • Selected requeue reports missing or ineligible identifiers instead of treating every request as successful.
  • Dead-letter replay uses bounded pages rather than loading the full dead-letter set.
  • Processor drain always has a timeout.
  • Inbox and outbox controls remain separate so a host can expose only the axis it runs.

Observability

SignalSourceUse
litebus.inbox.queue.depthLiteBus.Inbox meterRows grouped by inbox status
litebus.outbox.queue.depthLiteBus.Outbox meterRows grouped by outbox status
litebus.inbox.processor.stateLiteBus.Inbox meterRunning, paused, or draining state
litebus.outbox.processor.stateLiteBus.Outbox meterRunning, paused, or draining state
RetentionRunStatusManager APILast retention time, deletion count, and error
StoreSchemaInfoManager APILogical or database schema version
IDiagnosticCheckHost manifestStorage, transport, or application readiness

Management endpoints do not define a separate meter. ASP.NET Core request telemetry supplies HTTP status and latency at the host boundary.

Invariants

  • Manager contracts do not expose EF Core, Npgsql, or broker SDK types.
  • Store queries use deterministic keyset ordering.
  • Retention targets terminal rows only.
  • Processor control changes leasing behavior without changing stored message state directly.

Non-Goals

  • Cross-region replication control.
  • Built-in role or identity management.
  • Direct broker consumer administration.
  • A unified manager that hides inbox and outbox semantics.

Test Coverage

Covered Use Cases

TestProves
InboxManagerOperationsTestsQuery, missing get, status counts, schema, paged dead-letter replay, purge safety, retention success, and retention failure
OutboxManagerOperationsTestsThe equivalent outbox manager contract
InboxStoreContractTests.QueryAsync_ShouldFilterAndPageByCreatedAtStore adapters satisfy filter and keyset pagination behavior
InboxStoreContractTests.PurgeAsync_ShouldDeleteMatchingRowsStore purge honors typed predicates
InboxProcessorControlTestsPause, resume, and drain behavior on the concrete inbox processor control
OutboxProcessorControlTestsPause, resume, and drain behavior on the concrete outbox processor control
PostgreSqlInboxHostingIntegrationTests.CleanupBackgroundService_ShouldPurgeCompletedRowsPastRetentionHosted PostgreSQL inbox retention deletes eligible rows
ManagementEndpointAuthorizationIntegrationTestsASP.NET Core authentication and named-policy behavior
ManagementEndpointPostgreSqlIntegrationTestsHTTP query, purge, and diagnostic routes use PostgreSQL-backed managers
ManagementEndpointOperationsTestsInbox and outbox route binding, processor controls, missing axes, and custom prefixes
LiteBusHealthCheckIntegrationTestsManifest diagnostic checks map to ASP.NET Core health status

Untested Use Cases

  • Long-running operator requests canceled by a disconnected HTTP client.
  • Management endpoint HTTP 500 response content after an unexpected adapter exception.

Out-of-Scope Use Cases

  • Cross-region message replication management.
  • Multi-cluster processor federation.
  • Built-in identity provider configuration.

Deep Docs

On this page