Skip to content

Architecture Decisions

A. Shafie edited this page May 28, 2026 · 3 revisions

Architecture Decisions

These records capture design choices that should remain stable unless a future major version changes the project boundary.

ADR-0001: Commands, Queries, and Events Stay Separate

Status: Accepted

LiteBus keeps ICommand, IQuery, and IEvent as separate concepts. A command expresses an intention to change state, a query reads state, and an event reports a fact. Collapsing them into a single request abstraction would remove the semantic API that distinguishes LiteBus from generic mediator libraries.

ADR-0002: Events Can Be POCOs

Status: Accepted

Events can be plain CLR objects. This lets domain projects define events without referencing LiteBus. Applications that prefer explicit markers can still implement IEvent.

ADR-0003: LiteBus Is In-Process

Status: Accepted

LiteBus mediates work inside a process. Inbox and outbox packages can store work and facts, but LiteBus does not become a distributed message broker. Broker adapters should live in optional packages.

ADR-0004: The Inbox Schedules Commands

Status: Accepted

The command inbox stores ICommand for later execution. It does not return handler results and does not replace an outbox. Inbox submission uses ICommandScheduler.ScheduleAsync; ICommandMediator.SendAsync always executes in process.

ADR-0005: The Outbox Is Separate from Event Mediation

Status: Accepted

Event mediation dispatches handlers in process. An outbox records facts that must be published after a state change. IEventPublisher.PublishAsync notifies in-process handlers now; IIntegrationOutbox.AddAsync stores an integration event for later publication.

ADR-0006: Ambient Context Uses AsyncLocal

Status: Accepted

The execution context uses ambient async flow so pre-handlers, handlers, post-handlers, and error handlers can share cancellation, tags, and Items without adding parameters to every handler interface. Streaming queries must preserve that context during enumeration.

ADR-0007: DI Integration Is Adapter-Based

Status: Accepted

The runtime owns a small dependency registration abstraction. Microsoft DI and Autofac integrations translate LiteBus descriptors into container registrations. The core mediator stays independent of one container.

ADR-0008: Persisted Messages Use Stable Contracts

Status: Accepted

Inbox and outbox storage use stable contract names and integer versions. They do not store assembly-qualified type names as the persisted contract. The contract registry maps CLR types to persisted contracts at the application boundary.

Clone this wiki locally