So I have this enum class
enum class ServerType {
Cloud,
Colocation,
Dedicated
}
However our team decided to change the name of some value to
enum class ServerType {
Cloud,
DataCenter,
Dedicated
}
So I’m considering making a conditional upcaster using SingleEventUpcaster. So I have custom implementation for upcaster and it may look like this.
AxonEventUpcaster.withType<ServerCreatedEvent>()
.withVersion("1.0", "2.0")
.upcaster { documentEditor ->
if (documentEditor["serverType"] == "Colocation") {
return documentEditor.changeValue("serverType", "DataCenter")
}
return documentEditor
}
.build()
so is it good idea to put some condition in the upcaster. I’m worried because upcaster would add an overhead to event processor so it should be cheap and not complex operation.