Welcome aboard @orange256!
Be sure to reach out with any questions you might face here on the forum.
Furthermore, I hope you’ll find your journey into Axon a pleasant one.
Interesting request, @orange256.
Perhaps you can share why you are looking for this functionality?
With that bit of information added to your questions, other readers would be better suited to understand where you (and your team) are coming from, making it clearer whether somebody else’s needs align.
Regardless of that information, I am confident I can help you further.
Firstly, the “overriding” behavior of snapshots only occurs for the RDBMS- and Mongo-based storage solutions. If you would use Axon Server, each snapshot will be a unique entry. If you are inclined to use an RDBMS or Mongo EventStore
, that means you have some manual steps to undertake.
The simplest one to adjust would be the JdbcEventStorageEngine
as it allows users to adjust any SQL query. In your scenario, you would be required to adjust the appendSnapshot
operation to make unique entries instead of overwriting existing ones. To configure different statements, you will be required to build a JdbcEventStorageEngine
through it’s builder (the JdbcEventStorageEngine.Builder
class, which you can retrieve through JdbcEventStorageEngine#builder
).
Secondly, if you want daily snapshots at a fixed point in time, you will need to construct a custom SnapshotTriggerDefinition
. The EventCountSnapshotTriggerDefinition
and AggregateLoadTimeSnapshotTriggerDefinition
work on a total event count and overall load time respectively. When these milestones are hit, a snapshot will be created.
For fixed daily snapshots, you would thus write a SnapshotTriggerDefinition
that keeps track of time to ensure a snapshot is created once every day for the active aggregates.
This is, obviously, some custom code. Configuring a custom SnapshotTriggerDefinition
is no different from configuring the event-count and load-time-based triggers, though.
Concluding, I hope this helps you further, @orange256!
If not, be sure to reply below.