tellus
Docs

Event-sourced actors

Make the devices survive restarts with event sourcing, in memory first, then in PostgreSQL.

The devices of the getting started tutorial keep their last reading in memory, so it is gone after a restart. In this tutorial they persist what happens to them as events and recover their state from those events. They recover in a new actor system, after a restart, faster with snapshots and finally across processes, with PostgreSQL. You need the persistence-in-memory feature for the first three steps. The last one needs the tellus-persistence-postgres crate and Docker. Besides the crates of the getting started tutorial, the programs use serde with its derive feature.

  1. An event-sourced devicePersist readings as events and recover the last one in a new actor system.
  2. When devices fail, againLet a failing event-sourced device restart and recover its state by replay.
  3. SnapshotsShorten recovery with snapshots, so a device does not replay its whole history.
  4. PostgreSQLStore the device's events and snapshots in PostgreSQL and recover them across processes.