1
votes

I am using axon 3.1.1, while storing events to mongodb,
I am able to store it in XML format.
but while converting it to JSON format using Jackson serializer I am not able to get what's Storage strategy.

what I am doing is here
@Bean
public EventStorageEngine mongoEventStorageEngine() {
return new
MongoEventStorageEngine(axonJsonSerializer(),NoOpEventUpcaster.INSTANCE, aggregateMongoTemplate(),[strategy??]);
}

Also please share what if I don't want any storage strategy and keep this default

Thanks in Advance

1

1 Answers

3
votes

The storage strategy defines how you want the events stored in MongoDB. There are 2 options, DocumentPerEventStorageStrategy, where each event becomes a single mongo document, or DocumentPerCommitStorageStrategy, where all events within a commit are stored as a single mongo document.

Storing an entire commit in a single document has the advantage that a commit is stored atomically. Furthermore, it requires only a single roundtrip for any number of events. A disadvantage is that it becomes harder to query events manually.

The default is the DocumentPerEventStorageStrategy.