How to change the storage of events?

Hi,

I would like to change the way serialized events are stored in the database.
The goal is to store them as TEXT (or even Postgresql XML type) instead of
BLOB to have an ability of searching over them (and maybe transforming
the XML in certain cases).

What is the proper way to change the field type (we use version 1.4)? At the
moment I’ve came up with an implementation where DefaultEventEntryStore,
DomainEventEntry, SnapshotEventEntry are replaced with corresponding
implementations using textual representation and are injected in Spring context.
The problem is that we’ll have to support them and adapt to later releases of
Axon which could be a problem in case, for instance, JpaEventStore is changed.
I don’t like this implementation also because it makes redundant conversions
between byte[] and String quite too often.

So, any ideas about how to make it with lesser custom coding?

Hi Misha,

implementing your own EventEntryStore is the best way to customize the way events are stored in a table. If you are concerned about keeping your EventEntryStore up-to-date with Axon releases, keep in mind that this API will only change in major releases (and maybe not even then). The storage has changed between Axon 1 and Axon 2 for a number of reasons, performance is one of them. The number of conversions in Axon 2 has been reduces, because you’re not forces into any format with the EventEntries you read. They will be converted to whatever format your serializer or upcasters need on demand.

Did you try to simply change the column type in the database, without changing any of the code?

Cheers,

Allard