Download the PHP package morebec/orkestra-postgresql-eventstore without Composer
On this page you can find all versions of the php package morebec/orkestra-postgresql-eventstore. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download morebec/orkestra-postgresql-eventstore
More information about morebec/orkestra-postgresql-eventstore
Files in morebec/orkestra-postgresql-eventstore
Package orkestra-postgresql-eventstore
Short Description PostgreSQL Event Store for Orkestra
License Apache-2.0
Informations about the package orkestra-postgresql-eventstore
PostgreSqlEventStore
This component provides an implementation of a the an Event Store (from the [EventSourcing Component]()) using PostgreSQL.
Under the hood, it uses DBAL for communication with PostgreSQL.
Installation
Usage
Event Store Subscriptions
The pu/sub mechanism of the event store is implemented using PostgreSQL's LISTEN/NOTIFY feature.
Unfortunately given the nature of PHP being a synchronous RunTime, the only way to have Pub/Sub capabilities
is to run a LISTEN loop:
This is can be used with Event Processors.
PostgreSqlEventStorePositionStorage
An implementation of EventStorePositionStorageInterface is also shipped with the component as the PostgreSqlEventStorePositionStorage,
which also relies on DBAL for communication with PostgreSQL:
PostgreSqlEventProcessor
A ready-made implementation of an Event Processor with support for the PostgreSqlEventStore
is also provided with this component:
Given that the
EventStoreInterfacecan be decorated, the processor cannot directly use thePostgreSqlEventStorethrough theEventStoreInterface. Also, since it requires using specific methods from the implementationPostgreSqlEventStoreto access some PostgreSQL specific features, the actual instance of thePostgreSqlEventStoremust be injected additionally. This is why both are injected in the constructor.
Testing
To run the tests execute the following command:
It is required to have an instance of postgresql running with a password-less role postgres and a database named postgres.
To easily get this setup and running a docker-compose configuration file is available at the root of this project.
To run it simply execute the following command:
All versions of orkestra-postgresql-eventstore with dependencies
ext-json Version *
ext-pdo Version *
ext-pgsql Version *
ext-pdo_pgsql Version *
doctrine/dbal Version ^3.0
morebec/orkestra-datetime Version ^2.5.6
morebec/orkestra-event-sourcing Version ^2.5.6