Problem: EventA:1.0 has to be upcasted to new version EventA:2.0 and - optionally - to emit also EventB:1.0. The optional event should be emitted (or not) based on the contend of EventA:1.0
Where to put upcasting logic based on upcasted event’s content (let’s say it is JsonNode event) so that I can produce various number of new events?
My note: in IntermediateEventRepresentation upcastPayload. there is an ‘upcatsFunction’ which should be an ideal place but it’s signature forces me to return new event, instead of e.g. Optional type.