Writing a custom serializer

I’d like to implement a Serializer using Kryo however the interface hierarchy is pretty big and complex. Does anyone know what the bare minimum is that I would need to implement?

`
Serializer
SerializedObject
SerializedType
ConverterFactory

`

It’s not very clear what the relationship between these interfaces and the overall serialization strategy is in Axon. Any thoughts or comments would be helpful.

Thanks

Hi Justin,

the Serializer interface is the one you need to implement. You can use JavaSerializer as an example.

The SerializedObject interface (and the SimpleSerializedObject implementation) are used to describe the serialized form. This object contains the actual bytes, String, InputStream, or whatever the data is serialized to, as well as some information about the type of object and version that was serialized. The latter two properties are captured in the SerializedType.

The ConverterFactory can be used to convert a SerializedObject that contains, for example, a byte[] to one that contains an InputStream or event String. Converters are commonly used when using upcasting. In such case, a serializer may be asked to serialize from, for example, a JSON object. If the serializer cannot handle JSON directly, but expects a byte[], it can use a converter to convert between these types.

Hope this helps.
Cheers,

Allard