TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Eventuous/eventuous/llms.txt
Use this file to discover all available pages before exploring further.
Eventuous.Postgresql package lets you use a standard PostgreSQL database as a fully-featured Eventuous event store. It stores streams and events in a schema managed by Eventuous itself and provides polling-based subscriptions for both all-stream and single-stream reads, plus a base class for writing SQL projections.
Installation
Schema
Eventuous manages its own schema inside a configurable PostgreSQL schema (default:eventuous). The schema includes:
| Object | Purpose |
|---|---|
{schema}.append_events | Stored function to append events atomically |
{schema}.read_stream_forwards | Read a stream from a given position |
{schema}.read_stream_backwards | Read a stream backwards |
{schema}.read_all_forwards | Read all events globally, ordered by position |
{schema}.read_stream_sub | Subscription read for a single stream |
{schema}.check_stream | Validate expected version |
{schema}.streams | Stream metadata table |
{schema}.checkpoints | Subscription checkpoint table |
Schema initialisation
SchemaInitializer is a hosted service that creates (or re-creates) the schema on startup when PostgresStoreOptions.InitializeDatabase is set to true.
InitializeDatabase as false.
Event Store
PostgresStore implements IEventStore on top of an NpgsqlDataSource.
PostgresStoreOptions properties:
| Property | Default | Description |
|---|---|---|
Schema | "eventuous" | PostgreSQL schema name |
ConnectionString | — | Connection string (used by SchemaInitializer) |
InitializeDatabase | false | Create schema automatically on startup |
Dependency injection
Subscriptions
Both subscription types poll the database on a configurable interval, making them compatible with any standard PostgreSQL instance without requiring logical replication.PostgresAllStreamSubscription
Reads every event in the database in global-position order, advancing a persisted checkpoint after each page.
- Options type:
PostgresAllStreamSubscriptionOptions
PostgresStreamSubscription
Reads events from a single named stream, tracking position per-stream.
- Options type:
PostgresStreamSubscriptionOptions - Key option:
Stream— theStreamNameto subscribe to
Checkpoint store
PostgresCheckpointStore persists subscription positions back into the {schema}.checkpoints table, so you can keep everything in the same PostgreSQL instance.
Projections
PostgresProjector is an abstract base class for event handlers that write read models into PostgreSQL tables. Override it and use On<TEvent> to register SQL commands per event type.
Project helper builds an NpgsqlCommand from a SQL string and either NpgsqlParameter objects or (Name, Value) tuples, cutting down on boilerplate.
Register the projector as a subscription event handler: