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

Now way to provide manifest when using JsonEncoder #56

Open
kungfoo opened this issue Nov 14, 2019 · 2 comments
Open

Now way to provide manifest when using JsonEncoder #56

kungfoo opened this issue Nov 14, 2019 · 2 comments

Comments

@kungfoo
Copy link

kungfoo commented Nov 14, 2019

I would love to combine the power of storing data as json or jsonb and providing a custom manifest that is not the class name (because that is likely to change.
Currently I cannot wrap my head around how to do that, since once I enable my JsonEncoder to be used, I can no longer provide a manifest.
I would like to include the the version of the event either in the manifest or, potentially even better in the tags as ('version', '1.0').

@kungfoo
Copy link
Author

kungfoo commented Nov 14, 2019

Previously I simply appended the version as a number to the manifest, like so:
Manifest type name:

manifest(ProductOrdered) = "sample.ProductOrdered-${version}"

This allows me to register adapters for upgrading old events to new versions.

@kungfoo
Copy link
Author

kungfoo commented Nov 14, 2019

Okay, I read the code and while I think it would still be nice to support this version via the manifest, there is also another way I could come up with to support versioning and adapters for versions:

package sample.product.events.v1

case class ProductOrdered extends Versioned("v1") (....)

And then using that version once I need to write an adapter from an old version to the new version. The type will have to remain in place for deserialization to work, but that's probably not even bad, because it is very explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant