Skip to main content
Now, let’s assemble all the components we have built in this tutorial—commands, events, the aggregate root, our in-memory store, and our dashboard view—into a single, working, executable Rust entry point.

The Assembled Code

Here is the complete setup to initialize a test application, dispatch commands to the write path, and update and query the read model:

Running the Verification

To run this in your terminal, add it to your src/main.rs file or a local integration test binary and run:
You should see the following console output confirming a clean, transactional command flow and asynchronous read model materialization:

Summary of the Tutorial

Congratulations! You have successfully built:
  • An aggregate root consistency boundary representing a bank account.
  • A write-side pipeline using an in-memory event ledger that reconstitutes state and enforces invariants.
  • A read-side projection that updates customized materialized views from committed event streams.
Now, let’s explore how we migrate this test setup into a production application using persistent SQL engines, checkpoint tracking, and metadata headers.