0
votes

I'm new on Axon framework and i want to configure Axon in order to store events as JSON. I'm using Spring-Boot and, as per documentation, i set some key/value in a .properties file

enter image description here

I expected to see events stored as JSON but i keep seeing XML in the serializedPayload of the MongoDB event store. I think I have configured the serilializers correctly but obviously I'm doing something wrong

Please note that debugging the application it seems that JacksonSerializer class is never invocated and instead XStreamSerializer class is called even my key/value configuration. So i need to understand why my jackson configuraton is not calling the right serializer

2

2 Answers

1
votes

You have to configure the MongoEventStorageEngine to use the Serializer you want.

Looking at it's Builder (specially the javadoc), you can see it offers a snapshotSerializer and a eventSerializer methods while the javadoc states that both of them defaults to XStreamSerializer.

If you need help configuring it, I can point you to the mongo-axon-example where you can see a project configured and running. The example is not using Jackson but it should be an easy addition to configure it here.

0
votes

Even if the documentation doesn't seem to mention it, it is not enough to add the key/value in the .properties file. You need also to add the JacksonSerializer to the MongoEventStorageEngine as following:

enter image description here