Tim Trewartha
Tim Trewartha

Reputation: 364

Akka.net persistence delete messages from a certain sequence number

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

Upvotes: 1

Views: 450

Answers (1)

Bartosz Sypytkowski
Bartosz Sypytkowski

Reputation: 7542

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.

Upvotes: 2

Related Questions