edreyer / modulith

Microservice arch deployed as monolith
MIT License
44 stars 10 forks source link

Can't see how CQRS is implemented in the current codebase #23

Open rassidm opened 11 months ago

rassidm commented 11 months ago

Hi Erik

Thank for for the answer :)

but I can't see how CQRS is implemented as an example for the booking module both writte and read operations go through the same persistence unit and end up in the same mongodb document.

in the booking module:

Both writte and read operations use AppointmentRepository and Both writte and read operations end up using the same DB table ( appointments Document on mongodb)

If you can please explain to me how CQRS is implemented ? thats will be appreciated

cheers

edreyer commented 10 months ago

Sorry for the slow response. I'm on vacation.

You are correct that the in this example, the reads/writes are from the same DB table. That said, the architecture supports read/writes from different tables using the ports/adapters mechanism. The actual AppointmentRepository implements a number of interfaces. It's those interfaces that are exposed to the business logic in Domain. You could easily split those interfaces to be implemented by multiple Repositories where each Repository goes to a different data store. One for reads, one for writes.

There is no code in this example that replicates data from a writable table to a readable one. The easiest way to achieve that is to use a read replica for the "Read" operations.

rassidm commented 10 months ago

Hi Erik

Thank you for the answer :)

I do really appreciate all the materials and techniques introduced in you repository

The questios I have:

If the stack/architecture introduced by this repository has been battle tested in a real world production application?

And If yes ,is it still retained?

And what are the most wanted features concepts that you think could be added/changed in the current architecture?

edreyer commented 10 months ago

"has been battle tested"?

More or less. The ideas in this repository have been. Some by me in other projects. Some by others. This specific architecture has not, per se, but there is nothing really controversial about this. What I've attempted here is to collect a number of good ideas that others have created, and combined them in an elegant way.

"most wanted features concepts that you think could be added/changed"

I'm open to ideas if you have them.