That’s my first experience with Axon and event sourcing, but could you please help me to understand the direction that should be used for some custom logic?
Despite the fact that EventStore should be an unmodifiable & single “point of true” I consider it valuable to be able to revert last events / reset event sequence to a specific event sequence Id. That’s the case when I’d need to remove totally incorrect events, instead of adding compensation events. But as far as I see EventStore & CommandGateway provide onle read / write operation interfaces. I realize it’s a contradiction to CQRS approach, but is there any existing functionality to provide event delete operations using framework ecosystem?
I would very much appreciate your guidance and comments
You can easily purge all events when running Axon Server in development mode. You don’t want to delete events in production, as you get into a state of certain inconsistency. As you likely have some projections that already read the events.
As Gerard already points out, you would be able to perform those operations when dealing with the storage solution directly.
If you would use an RDBMS or Mongo to store events, you would thus directly approach either to perform the operation you want to do.
As stated for Axon Server, you can enable so-called “developer mode,” allowing you to purge events.
Note the bare bone interfaces of Axon Framework very deliberately do not provide operations to update or delete events, as it’s against the nature of an Event Store. Again, as Gerard points out, making these adjustments in a production system is plainly “wrong,” as the chance is very high there already are down stream consumers of those events.
If anything at a latter stage decides to change event sequences, you would need to inform all consumers of that change as well.
View it as if you would be able to change the past in real life; that will be an extremely tough endeavour to deal with too.
Hence, it is advised to think in compensating actions when working with life Event Sourcing systems. There, of course, always outliers why you would need to rewrite history, which should be thought of carefully. Axon Server also has support for this, through the Event Transformation functionality.
I hope all that explains things for you further, @orange256