I am facing a use case where I am going to receive a pure event as an input of my Axon project. What I mean by pure event is something which already happened and that is still worth persisting into my event store.
With Axon I always understood the default path was @CommandHandler -> @EventSourcingHandler to modify the aggregate state -> Event persistence in the event store -> etc.
Is there any way to somehow bypass the @CommandHandler. If this pure event was persisted by another service (not an Axon one). Is there any way to catch this event and to trigger the @EventSourcingHandler to modify the aggregate state afterward?
Something like the following flow:
- An external service persists an event in the event store
- This event triggers something in Axon which forward this event to the @EventSourcingHandler
- The aggregate state is then updated accordingly
- The views are then also updated depending on the event type
In this very use case, having to implement a @CommandHandler just to apply a one-to-one event would be useless from my humble opinion.
I hope my post is clear enough