Hi everyone. Collected some questions / concerns about snapshots while working with them…
At high level view I’m implementing billing system for users. User is my aggregate and it can have two main
types of operations: automatic charge / replenishment and manual charge / replenishment. Automatic type of events are
very frequent, manual not. Ideally for me to have two types of snapshots: default aggregate snapshot and custom, which
saves periodically groups of automatic events and creates new event based on such batches: total charged for one hour and total income for one hour for example.
First snapshot is good for fast retrieval of current aggregate state - current balance, second for displaying some sort of billing history without need to scan through
all automatic events.
- First problem I’ve encountered is that it is not possible to have several trigger definitions and thus different snapshots per aggregate. I guess I can implement
some chain of snapshoters, just curios if I’m missing something ?
- Is it possible to initialize projections and tracking tokens from latest default aggregate snapshot and not scanning through all of the events?
- Didn’t find AggregateSnapshot event in axon dashboard search menu. Found it in swagger api. Is it ok to use snapshot events like any other events or they are
for internal use only.
- What is the lifecycle of Trigger instance which is created by Trigger Definition? I guess it is coupled to aggregate, but for how long does it live. There is no shutdown or destroy
methods in it. I’ve created custom time based Trigger Definition and it has a per hour event publisher that is subscribed from all created triggers. Running for some period
of time will have lots of stale subscribers (not active users). Is there some good way to notify of trigger being destroyed ? Or probably there is better way to achieve time based snapshot creation ?
- Are there any checks when creating new snapshot for events between latest snapshot and current ? So that new snapshot is created for only active aggregate (Speaking about default snapshot)