Let's say we have an asynchronous event-driven system where service A owns some data, publishes events and service B is consuming them and is storing the copy of the data in its local DB.
I'd like to be able to check if the local copy in B is consistent with the source in A. I don't care about eventual consistency, I understand that B can be behind. What I care about is to check that
- The event producing code is correct
- We have not lost any messages in transit
- The consumer code is correct
All the literature I have seen either deals with eventual consistency or silently assumes that the event processing code does not contain any bugs. To me this is unrealistic. Can somebody point me where to learn about the subject, please?
The ideas we had:
- The event stream is the source of truth. Now we should check that the source DB and the event stream are in sync. It's doable
- Switch to event sourcing in A. We do not want to completely rewrite A
- Expose data on a sync endpoint on A and use it to check the inconsistencies (and fix them if needed).
- Ignore it and hope the systems will stay consistent and if not, nobody will notice :-)