How to create snapshots using GetStreamsToSnapshot in EventStore 3.0

We follow CQRS architecture and use Event-Store version 3 for Jonathan Oliver for events. We want to create a snapshot of the aggregate roots to increase productivity.

I found an API (GetStreamsToSnapshot) that can be used for this. It provides all streams based on how long the snapshots have been taken.

But I'm not sure how to use the stream to create a snapshot, since I don't know the type of aggregate.

Please provide any information on how to create snapshots.

Thanks Sachin

+4
source share
1 answer

As you have discovered, GetStreamsToSnapshot gives you a list of threads that have at least X changes behind the head version.

From there, it is a matter of loading each thread. Here you can add some header information to the stream to determine what type of population you have in mind.

Many times they ask me why I do not just store information about summary types directly in EventStore and make it a first-class part of the API. The answer is that it does not care about aggregates, which are the concept of DDD. All EventStore take care of streams and events.

+2
source

Source: https://habr.com/ru/post/1389470/


All Articles