Event store entry point


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 :slight_smile:

Until you get a more definitive answer, I believe you would just inject the EventBus (which would be backed by an EventStorageEngine according to your description) and then use that to publish your events.


The application that persists the events is not an Axon one.

Hi Teivah,

interesting question, because it’s a combination of technical issues, as well as design ;-). Conceptually, the fact that something happened in a system outside of your own boundary, doesn’t mean it’s a “given” for yours. Obviously, you cannot ignore the fact, because it still happened. You want your system to response on this event by generating an action that probably leads to an event, again. So, in short: be in the lookout for the event that describes what happens in “your” context, based on what happened in another.

Technically, you’d probably have a command that tells the aggregate: “hey, here’s something that happened!” In such case, an aggregate could just apply that event directly. Alternatively, you could also just append the Event to the event store.

Hope this helps.