Hello,
Our application is event driven and designed around DDD principles. Domain events are stored along with modified domain objects in a single Couchbase transaction. When the transaction succeed, events are picked up and put into a message queue for further integration with other services.
This requires events to be ordered in a sequence. We use a document to track the last integer and use this integer to identify the events. This document is part of every transaction, which results in poor performance. We understand this design is bad, and we are looking for an approach that is more suited the distributed nature of Couchbase.
We thought of using Couchbase’s DCP and the Kafka connector in order to publish events to Kafka. However, we are not sure how we could maintain the ordering of events since the order guarantee is given for a single vBucket. It is not possible to target a specific vBucket unless using this hack.
It seems we have to reconsider how we deal with domain events at an architecture level. However, we would like to keep using Couchbase as the primary database.
So, how do you deal with domain events and Couchbase in practice? Should we instead consider using Kafka in front of Couchbase (like suggested in this article)?
Thank for your consideration.
Camille