I’m building an application using Axon v2 milestone 1 to process FIX protocol messages.
The application is using all the standard facilities, SimpleEventBus, SimpleCommandBus, GenericAggrgateFactory
and my aggregates extends from AbstractAnnotatedAggregateRoot.
Things are working really well.
There is one situation I am trying to handle in a nicer way.
When I receive FIX message(say an Execution Report) with the wrong id, I’m getting an exception deep inside Axon
ERROR org.axonframework.commandhandling.SimpleCommandBus - Processing of a OrderExecuteCommand resulted in an exception:
java.lang.NullPointerException
at org.axonframework.eventsourcing.AbstractAggregateFactory.createAggregate(AbstractAggregateFactory.java:18)
at org.axonframework.eventsourcing.EventSourcingRepository.doLoad(EventSourcingRepository.java:156)
at org.axonframework.eventsourcing.CachingEventSourcingRepository.doLoad(CachingEventSourcingRepository.java:94)
at org.axonframework.eventsourcing.CachingEventSourcingRepository.doLoad(CachingEventSourcingRepository.java:37)
at org.axonframework.repository.AbstractRepository.load(AbstractRepository.java:64)
at org.axonframework.repository.LockingRepository.load(LockingRepository.java:118)
at org.axonframework.commandhandling.annotation.AggregateAnnotationCommandHandler.loadAggregate(AggregateAnnotationCommandHandler.java:159)
at org.axonframework.commandhandling.annotation.AggregateAnnotationCommandHandler.access$000(AggregateAnnotationCommandHandler.java:46)
at org.axonframework.commandhandling.annotation.AggregateAnnotationCommandHandler$1.handle(AggregateAnnotationCommandHandler.java:140)
at org.axonframework.commandhandling.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:62)
at org.axonframework.commandhandling.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:68)
at org.axonframework.commandhandling.SimpleCommandBus.doDispatch(SimpleCommandBus.java:118)
at org.axonframework.commandhandling.SimpleCommandBus.dispatch(SimpleCommandBus.java:79)
How can I handle this error in a graceful way?