-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from moleculer-go/feat/snapshot
Feat/snapshot
- Loading branch information
Showing
17 changed files
with
1,347 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
# cqrs | ||
CQRS Pluggin and components | ||
|
||
|
||
## Snapshots | ||
|
||
snapshotName := aggregate.snapshot(): | ||
- pause event pumps -> pause aggregate changes :) | ||
- create a snapshot event -> new events will pile up after this point! = Write is enabled. | ||
- ** no changes are happening on aggregates ** but reads continue happily. | ||
- backup aggregates -> aggregate.backup(snapshotName) (SQLLite -> basicaly copy files :) ) | ||
- restart the event pump :) | ||
- done. | ||
- Error scenarios: | ||
- if backup fails the event is marked as failed and is ignored when trying to restore events. | ||
- Rationale: | ||
---> Since you created an event about the start of the snapshot at the same moment you paused the pump. this event should point to the backup file. so it can be used when restoring the snapshot. | ||
|
||
|
||
The restore an snapshot is also very simple | ||
aggregate.restore(snapshotName) | ||
- Condition: event pump is paused. | ||
- find backup files using snapshotName and locate snapshot event in the event store. | ||
- ** at this stage the event store might be receiving new events -> write is enabled ** | ||
- backup is restored. | ||
- read is enabled :) | ||
- events start processing from the snapshot moment | ||
- ** system takes a while to catch up ** | ||
- system is eventually consistent :) | ||
|
||
|
||
## Event Store | ||
|
||
Write test cases for the lifecyc;e variable "dispatchEventsStopped" |
Oops, something went wrong.