Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

SQLStreamStore/Patterns

Repository files navigation

Memento Persistence

A recipe for persisting Mementos (documents / snapshots) in SQL Stream Store. It's a bit like a key-value store with versions.

Why?

  • The model is CRUD-Y, you don't want to use an RDMBS but want to use CQRS, streams and projections.
  • The model doesn't care about domain events (or "business decisions"). The intermediate / final states are the only interesting things.
  • You want to retain some or all previous versions.
  • You want the option to execute a query against your memento backed object without needing a projection.

How?

  • Store the memento as the message itself in a stream.
  • Stream metadata decides how many previous copies to retain.
  • Loading a memento is reading stream backwards by one message only so rehydrating the corresponding object is fast.

Use cases

  • User settings / system configuration etc.
  • Data coming from external systems where they are the source of truth.
  • Snapshots for streams that are (domain) event based.

Explore

Best thing to do is clone the repo and step through the tests.

About

SQLStreamStore as a memento (key-value) store.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages