Basic requirements:
- Permanent reliable storage
- The order of events is defined
- Usually it is not necessary to change/delete, but sometimes it is necessary. 2 examples:
- The client has disconnected. We do not want to store his data to reduce the cost of storage and for legal requirements.
- We have a SaaS solution and there is a restriction on the storage history in the tariff (to limit the cost of storage) – you need to delete
A separate question is whether we want to change old events in order to migrate them to a new event scheme: one option is to bring (but there is a chance to spoil something), the second is not to bring and forever support all versions of all events in the code (increasing the cost of support).
Globally 4 solutions:
- traditional database (for example, PostgreSQL)
- Document-oriented database (e.g. MongoDB)
- Queue system (e.g. Kafka)
- A specialized system (for example https://www.eventstore.com or https://developer.axoniq.io/axon-server/overview )
In general, after thinking about it, I have about the following conclusions:
- I have not seen good specialized open source solutions (PostgreSQL level), but using commercial ones as the basis for a product is still bad (it’s not for nothing that many people have not even considered the same Oracle in recent years)
- There are additional problems with queues (because they are more limited than databases), but starting from some scale it makes sense
- A document-oriented database or a traditional one is not so important, it’s more about the technologies used in the company