Serializing JpaEventStore events as XML

I am using Axon 2.3.2 with Spring-boot-web/data 1.1.8

I have configured my app to use a JpaEventStore, currently to an H2 database.
The DOMAINEVENTENTRY table gets inserted to, everything looks OK, but I would prefer to have the event data serialized as XML, rather than as a Blob.

I have instantiated the store with JpaEventStore (entityManagerProvider, new XStreamSerializer()), but my events are still blobs.

What's missing?


Hi Phil,

the datatype used by the event store is not defined by the serializer itself, but by the event store. By default, it uses a Blob, because it works independently of the type of serializer used. So in this case, it’s a blob that contains XML data.

If you want to store it as a character type, you can customize the JpaEventStore by configuring a custom EventEntryStore. The latter defines how each entry is stored in the database. The DefaultEventEntryStore can be subclassed in case you don’t want anything drastically different. You’ll have to create your own entities to store, and override the protected methods of DefaultEventEntryStore to use these entities.

Hope this helps.