I am not sure how to check if the snapshot has been created and where to find snapshots. Axon Server folder has a file called “00000000000000000000.snapshots” located in Axon Server → data → default folder. But it seems like this file never changes. No new files are created either.
Where does Axon Server store snapshots by default?
Here is how I configure Snapshotting:
Add the following annotation above the Aggregate class: @Aggregate(snapshotTriggerDefinition = "myTriggerDefinition")
In the main application file, I create a Bean:
@Bean(name = “myTriggerDefinition”)
public SnapshotTriggerDefinition myTriggerDefinition(Snapshotter snapshotter) {
return new EventCountSnapshotTriggerDefinition(snapshotter, 2);
}
After I generate a few events, the 00000000000000000000.snapshots file does not get updated at all.
Only after adding the following dependency, I can see a log entry “Snapshot created”. But the 00000000000000000000.snapshots is still not updated and no new files are created in the Axon Server → data → default folder.
Do I need the axon-spring-boot-autoconfigure dependency for Snapshotting to work?
When debugging the state of the Aggregate object it looks like the snapshot is created only after adding the axon-spring-boot-autoconfigure dependency…
Until I started creating Snapshots, my application worked fine without the axon-spring-boot-autoconfigure dependency. I do have axon-spring-boot-starter in the pom.xml file. My application is able to handle commands and events, use Saga annotations, and command intercepters work fine. Using axon-spring-boot-starter was enough to make it all work.
Looking into the axon-spring-boot-starter dependency, it looks like it depends on the axon-spring-boot-autoconfigure. Why do I need to add it explicitly if I already have axon-spring-boot-starter?
UPDATE:
Apparently, adding the axon-spring-boot-autoconfigure dependency, additionally to axon-spring-boot-starter is not necessary for Snapshotting to work.
The snapshot seems to be created with only axon-spring-boot-starter dependency in pom.xml. It is just with axon-spring-boot-starter version 4.4.5 when a Snapshot is created, there will be a log message “o.a.a.c.event.axon.AxonServerEventStore : Snapshot created”. When using Axon version 4.4.7, there will be no longer a log message confirming that the snapshot is created…
Using version 4.4.7, unless debugging the state of the aggregate, it is hard to know that the Snapshop did get created… I wish Axon Server dashboard could show a list of created Snapshots…