Configure snapshot with database separate

I work with spring boot 2 and axon 4.4.2, i want to implement a snapshot feature, i tried with the below code but i find nothing in the table snapshot_event_entry in the database.

For the database i separate it, one for projection and the other for event. This link content the config of command side.

Is there another configuration that i can add ?

    @GetMapping("snapshot/{id}")
    public ResponseEntity<Void> createSnapshot(@PathVariable String id) {
    	commandGateway.send(new PerformShapshotCommand(id));
    	return new ResponseEntity<>(HttpStatus.OK);
    }

    @Aggregate
    public abstract class ProductAggregate {

    	@AggregateIdentifier
    	private String externalId;

        @CommandHandler
        public void handle(PerformShapshotCommand cmd, @Qualifier("snap") Snapshotter snapshotter) {
    	    snapshotter.scheduleSnapshot(this.getClass(), cmd.id);
        }

    }

Simply invoking the Snapshotter#scheduleSnapshot method would typically be sufficient to construct a snapshot. However, we normally recommend that you use a SnapshotTriggerDefinition to tell Axon when you want to create snapshot. Such a trigger definition can occur after N events (the EventCountSnapshotTriggerDefinition) or when loading takes a certain amount of time (the AggregateLoadTimeSnapshotTriggerDefinition).

Using either of those and configuring it for your ProductAggregate will omit the entire requirement of a distinct command handler which invokes the Snapshotter for you. Thus, simplifying your configuration.

That you have separated your event and your projection tables into distinct databases is a good thing by the way. The Event Database should only contain the domain_event_entry and snapshot_event_entry table. The Projections Database would then contain the token_entry table and your projections. The tokens should be stored with your projections, as they state “how far your projections are up to date” in regard to the entire event stream.

Anyhow, none of the above points out why you are experiencing this issue… The shared configuration does no signal any warnings signs to me either. Looks like a fine config to me, sadly. Do you see the snapshot_event_entry table being created at all? And have you tried debugging the Snapshotter to validate its path. So to ascertain that it actually constructs the snapshot is desired?

At least give the SnapshotTriggerDefinition solution a try. Maybe there’s an issue with wiring the Snapshotter you are using right now, for example.