othillo / broadway-snapshotting
POC for snapshotting aggregates in broadway/broadway
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/othillo/broadway-snapshotting
Requires
- broadway/broadway: ^1.0
Requires (Dev)
- phpunit/phpunit: ^5.2
This package is auto-updated.
Last update: 2022-02-01 13:05:40 UTC
README
POC for snapshotting aggregates in broadway/broadway.
Installation
$ composer require othillo/broadway-snapshotting
Documentation
This project demonstrates taking and using snapshots of an aggregate root in the EventSourcingRepository.
Snaphots can be triggered using different strategies like once every number of events or
after an amount of time has passed. The EventCountTrigger implements the former strategy.
Getting started
This repository is just a library. It lacks (for now) implementations of the
SnapshottingEventStoreInterface and the SnapshotRepository.
For example if you want store your events and snapshots in a database using doctrine/dbal
you will have to:
-
extend the
DBALEventStorefrom broadway/event-store-dbal and implement theSnapshottingEventStoreInterfaceto query events that have been recorded since the last snapshot. -
create a
DBALSnapshotRepositoryimplementing theSnapshotRepositoryto store and fetch snapshots. You wil have to figure out how to serialize your aggregate root.
License
This project is licensed under the MIT License - see the LICENSE file for details