Closed max-voloshin closed 6 years ago
Hey thanks a bunch for your comment!
The source of truth in this case is the relational DB managed by Doctrine that complies with ACID, so both the aggregate and the events are stored correctly within a transaction.
The danger comes with inconsistencies in the projection side (projecting into Elasticsearch), you are right. But is not an issue in our example because we can always re-create the index based in the source of truth (this could be even done in an async fashion).
As the article you've sent, the proper way of doing this is with logs or probably better: with Event Sourcing, but ES is such a complex topic that it deserves its own book. That why we though it was enough for the CQRS example 👍
Thanks anyway :)
In subject chapter, there is an example
and the following explanation:
Actually
project
call may fail, and inconsistencies will exist due to dual writes problem: https://www.confluent.io/blog/using-logs-to-build-a-solid-data-infrastructure-or-why-dual-writes-are-a-bad-idea/More accurate way to synchronize a read model is pulling events from event store in projector instead of pushing them to projector after primary writes.