Hello all,
In my system I’d like to handle the two interaction types: commands and events. Commands are working well but I’m struggling with events.
My idea at first was to call the apply() function but I understood based on the following link that I could only do it within a @CommandHandler: https://groups.google.com/forum/#!searchin/axonframework/Cannot$20retrieve$20current$20AggregateLifecycle$3B$20none$20is$20yet$20defined|sort:relevance/axonframework/Es2ORDr0DYI/vaODFvJPBAAJ
So my second idea was to use the Event Bus for that. The EventBus implementation I use is an EmbeddedEventStore with my own EventStorageEngine:
eventBus.publish(newGenericEventMessage<>(myEvent));
I assume this code would trigger the @EventSourcingHandler then the @EventHandler(s). But it triggered solely the @EventHandler(s).
Am I missing something here? Shouldn’t an event sent by the EventBus be caught by an @EventSourcingHandler?
If not is there any way to trigger an event without having to go first with a @CommandHandler and doing it with an apply()?
Thanks for the help!