Have a scenario with an event with generic data;
AggregateEvent<T> aggregateEvent;
EventHandler listener for lister1 listens for
AggregateEvent<ConcreteDataType1> event
and another event handler listener2 listens for
AggregateEvent<ConcreteDataType2> event
Event fired is only with a Aggregate which has <T> in abstract class and the inherited class gets its own repository and data type e.g.
Have AbstractAggregate<T>
ConcreteAggregateForType1 extends AbstractAggregate< ConcreteDataType1> and ConCreteAggregateForType2 extends AbstractAggregate<ConcreteDateType2) and they apply the above events.
Axon is firing both Event handlers for AggregateEvent<ConcreteDataType1> and throwing class cast exceptions... when is should be firing for the event with its corresponding data Type ConcreteDataType1 and neglecting the other handler. This is major issue for reuse in design, otherwise lot of cut and paste code for type specific transformations in the listeners with payload/pass through type data differing for aggregates inherited leveraging generics and common aggregate logic for types/flavors of similar aggregates.
Any thoughts... Cheers and Thanks