KurrentDB
akashic-backend-kurrent stores events in KurrentDB streams and subscribes through its native subscriptions.
What it covers
KurrentDB holds the events and serves the subscriptions. Snapshots, checkpoints and subscription leases need another store, and the usual choice is PostgreSQL through akashic-backend-exposed. BackendProviderKurrent takes those as providers:
The checkpoint store is the PostgreSQL one with a CheckpointKurrentSerializer, because a KurrentDB position is a commit and prepare pair, not a row ID. Run the PostgreSQL migrations as described in PostgreSQL; the events table is simply unused.
The provider implements BackendProvider<CheckpointKurrent>, and the application code is the same:
Mix capabilities yourself
BackendProviderComposed assembles a provider from any five capability providers, for combinations the two shipped providers do not cover:
Streams
Each aggregate has one stream, named akashic-<length>-<aggregate type>-<aggregate ID>, where the length is that of the aggregate type. The account acc-1 lives in akashic-7-Account-acc-1. The stored event type is the name from your EventTypeNames, and the command, correlation and causation references are stored as event metadata.
The akashic- prefix is the default streamPrefix of BackendProviderKurrent, EventStoreProviderKurrent and EventSubscriptionProviderKurrent. Global subscriptions filter $all on it, so an application whose streams already carry another prefix passes that prefix to both providers; changing a deployment's prefix orphans its existing streams.
How appends work
A command is one appendToStream call to the aggregate's stream, with the prepared event IDs and the expected revision. There is no read before the write and no auxiliary stream or index. KurrentDB deduplicates on event ID, so resubmitting a prepared append is safe.
If the call fails ambiguously, the backend resubmits the same append once. If the outcome is still unclear, handle returns OutcomeUnknown with the prepared append; see Command results.
Subscriptions
An aggregate source subscribes to the streams of one aggregate type, and a global source to every Akashic stream. KurrentSubscriptionConfig carries the shared SubscriptionOptions for batch size and buffering. Build idempotency generations from the position:
Client lifecycle
You create the KurrentDBClient and you close it, after the runners and sources that use it: