Java Records for Events, Command and Aggregate Members

Is it completely safe to use Java records for Axon Commands, Events and also Aggregate Members. Or are there any pitfalls (maybe with upcasting or other mechanisms I am not aware right now?
On github I only find a very simple example which is using Java records right now ( giftcard-demo/src/main/java/io/axoniq/demo/giftcard/api at main · AxonIQ/giftcard-demo · GitHub^).

Hi Bernhard,

there should be no problem at all using Java records. Just as with any other class, you’ll have to check proper serialization formats. Generally, records tend to support serialization quite well.

Kind regards,

Allard

2 Likes