Overview
Usage¶
This section covers the core concepts of Gember Event Sourcing and how to use them in your application.
The typical flow is: define domain events that describe what happens in your domain, create commands that carry the intent to trigger changes, build use cases that protect business rules and apply events, and wire them together with command handlers. For cross-boundary workflows, add sagas.
Core concepts¶
These topics are listed in recommended reading order — each builds on the previous:
- Domain events - Define and work with domain events, including naming, serialization, and domain tags
- Commands - Define commands that carry intent and domain tags for event retrieval
- Use cases / aggregates - Model business logic using event-sourced use cases and traditional aggregates with DCB or aggregate patterns
- Command handlers - Trigger behavioral actions on use cases using command handlers
- Sagas - Implement long-running business processes that coordinate complex workflows across multiple domain events
Operational¶
- Snapshotting - Optimize reconstitution performance by capturing point-in-time use case state
- Outbox - Ensure reliable delivery of domain events and saga commands using the transactional outbox pattern
- Observability - Structured logging for event store, command handling, and saga execution
- Caching - Cache resolver and registry metadata to avoid runtime reflection overhead
Related resources¶
- For more extended examples and complete implementations, check out the demo application gember/example-event-sourcing-dcb