Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin Serializer implementation #13

Open
Blackdread opened this issue Jan 1, 2020 · 4 comments
Open

Kotlin Serializer implementation #13

Blackdread opened this issue Jan 1, 2020 · 4 comments

Comments

@Blackdread
Copy link

I have not looked into it yet but I think it can be useful to provide something similar to JacksonSerializer/XStreamSerializer/etc using kotlinx.serialization.

Since I had issues with Jackson with default values and inline class: event changes

Using kotlinx.serialization may be a better solution.
If not mistaken, they do not support inline class yet but it will come later for sure.

I will try an implementation later of org.axonframework.serialization.Serializer using kotlinx.serialization.

@smcvb
Copy link
Member

smcvb commented Jan 2, 2020

If you go down this route, @Blackdread, make sure the provided serializer works as expected for every object the framework serializes and deserializes at any point in the code base.

Added, if you could share some benefits of providing a KotlinSerializer which implements Axon's Serializer interface, that would be very helpful to understand your stance and drive behind this issue.

@smcvb smcvb changed the title Kotlin serialization Kotlin Serializer implementation Jan 2, 2020
@sandjelkovic
Copy link
Member

Kotlin serialization has reached a first stable release
https://github.com/Kotlin/kotlinx.serialization/releases

@hiddewie
Copy link
Contributor

hiddewie commented May 23, 2021

See #124. I added a basic implementation of a Kotlin serializer that works with the Axon interface. There are test cases to demonstrate how it works.

Ref https://kotlinlang.org/docs/serialization.html with basic overview.
Ref https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serialization-guide.md with serialization guide.

I can give some benefits of the Kotlin Serialization approach:

  • Jackson (and most other JVM serializers I know) use reflection which takes a performance hit.
  • Kotlin Serialization integrates very easily into the Kotlin language features. For example sealed classes work out of the box, which is not true for Jackson.
  • Future enhancements could add other forms of serialized formats, see https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/formats.md

A possible disadvantage is the compiler plugin that is needed to generate the serialization implementation for each class.

@smcvb
Copy link
Member

smcvb commented Oct 12, 2021

I've adjusted the milestone to 0.3.0 instead of 0.2.0.

The intent for this is the desire to release 0.2.0 of the Kotlin extension.
We felt we couldn't wait much longer until this release.

@smcvb smcvb removed this from the Release 0.3.0 milestone Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants