I need to upcast a PlayerCreated event in my spring boot axon application.
The original event did not have a @Revision annotation, so the revisionNumber is "null".
private fun playerCreated(revision: String?) = SimpleSerializedType("d.h.r.PlayerCreated", revision)
@Bean
fun playerCreatedNullTo2() = object : SingleEventUpcaster() {
override fun canUpcast(ir: IntermediateEventRepresentation): Boolean {
return playerCreated(null) == ir
}
override fun doUpcast(ir: IntermediateEventRepresentation): IntermediateEventRepresentation {
return ir.upcastPayload(playerCreated("2"), PlayerCreated::class.java, { createNewEvent })
}
}
However, the Upcaster is not used.
In the docs I read that must provide a custom JpaEventStorageEngine bean and set the upcaster.
I am using the axon-spring-boot-starter, so I do not define this bean, and I'd rather stick to the default implementation.
What is the correct way to register my upcaster? Also: when I do define my on storageEngine, the constructor does only allow one upcaster, what if I need more?
Thanks in advance!
Jan