axon2.0 upcaster to upcast multiple events into one

I am new to axon and have a question… current version is producing 3 different events and we are consolidating them to one.

UserAdded ==>UserFirstName,LastName
UserAddressChanged==>UserAddress

To

UserInformationChanged ==>UserFirstName,LastName,Address

so there would be case where i would have to refer to userAdded event to upcast UserAddressChanged.

I am going with assumption that event upcasting is the best approach.

I can see that axon 3.x has ContextAwareEventMultiUpcaster which should serve my purpose, but i don’t see something similar in 2.0

Is there a way, i can achieve my goal without upgrading?

Are there any sample or reference example with tests for various options in upcasting? I have seen very primitive examples so far.

any guidance would be highly appreciated.

Hello Hiten,

Axon 2 doesn’t have the same structure as Axon 3, in this matter. In Axon 3, an upcaster is basically a conversion of Stream<> to Stream<>, while in Axon 2, upcasters are much more individual. However, it should be possible to implement this requirement by using a Thread local. Not the most beautiful solution, but it should work. Still, if upgrading is an option, I would seriously consider it.

Hope this helps.
Cheers,

Allard

Thanks for your reply. Do you have any reference implementation or example on how can i achieve it?

Please let me know

Thanks!
Hiten

Hi,

unfortunately, I am not aware of any code sample that does it in this way, in Axon 2.
Anyone else?

Cheers,

Allard