1

Is there a way to delete messages after a certain sequence number in Akka.net? I know that DeleteMessages(seqNumber) deletes all messages before a certain sequence number, is there a way to delete after a seqNumber? The main goal would be to revert to a previous state (perhaps those messages were created in error).

It's obviously possible to edit the database manually (or set is_deleted to true for those events) but I'm not sure if that would be a great idea.

Thanks

Dadep
  • 2,796
  • 5
  • 27
  • 40
Tim Trewartha
  • 364
  • 3
  • 10

1 Answers1

2

DeleteMessages(seqNr) exists only for purpose of saving the space in case when you're using eventsourcing with snapshots, and your system can tolerate incomplete history of events.

Deleting events is against eventsourcing as a concept. Purpose of the event is to describe fact, that has already happened. You cannot alter the past, as there might have been some other sources that already read up that event and updated some state / performed an action according to it.

Correcting effects of events in eventsourced systems usually comes down to producing a compensating event, that is going to reverse effects of the one, you want to fix.

Bartosz Sypytkowski
  • 7,463
  • 19
  • 36
  • That makes sense, thanks for the response. I'm also thinking of having an option to revert an event-sourced entity to a previous state. In this case would it make sense to have a "Revert" event that is added at the end of all the previous events? It's easy enough to implement, just wondering if it makes sense from an event sourcing perspective. Thanks again. – Tim Trewartha Apr 16 '18 at 08:36