Repository is structured in two folders:
Libraries are implemented in a separate maven projects and packaged independently into ‘jar’ archives. This promotes code sharing, reuse and it will enable us to apply microservices architecture style as an alternative to a monolith style.
At this stage we have one deployment pipeline for all projects (apps & libs). In addition, all projects in the repository share the same dependencies. Hence, there are no version conflicts b/c everyone has to use the same/ the latest (snapshot) version. And you don’t need to deal with a private maven repository when you just want to use your own libraries.
Domain Driven Design is applied through Event Sourcing and CQRS. How Event Sourcing enables deployment flexibility - the application can be deployed as a monolithic or microservices.
The application is literally split into a command-side (domain) component and a query-side (materialized view) component (this is CQRS in its most literal form).
Communication between the two components is
event-driven and the application uses simple event store (Database in this case - JPA) as a means of passing the events between components of a monolithic applicaton.
Eventsbeing generated which are persisted by Axon, and propagated out to other components. In event-sourcing, events are the sole records in the system. They are used by the system to describe and re-build domain aggregates on demand, one event at a time.
Eventsand processes them in whatever way makes the most sense. In this application, the query-side just builds and maintains a materialised view which tracks the state of the individual agregates (Project, Blog, Team …).
Modular approach is enabling us to use microservices pattern and deploy components from monolithic application as independent applications/containers. The domain is split into a command-side microservice application/container and a query-side microservice application/container.
Communication between the two microservices is event-driven and we use RabbitMQ messaging as a means of passing the events between processes (VM’s).
The command-side processes commands. Commands are actions which change state in some way. The execution of these commands results in Events being generated which are persisted by Axon and propagated out to other VM’s (as many VM’s as you like) via RabbitMQ messaging. In event-sourcing, events are the sole records in the system. They are used by the system to describe and re-build aggregates on demand, one event at a time.
The query-side is an event-listener and processor. It listens for the Events and processes them in whatever way makes the most sense. In this application, the query-side just builds and maintains a materialised view which tracks the state of the individual agregates (Product, Blog, Team, …). The query-side can be replicated many times for scalability and the messages held by the RabbitMQ queues are durable, so they can be temporarily stored on behalf of the event-listener if it goes down.
The command-side and the query-side containers both have REST API’s which can be used to access their capabilities.
$ git clone https://github.com/ivans-innovation-lab-monorepos/my-company-backend.git
$ cd my-company-backend $ mvn clean install
$ cd my-company-backend/my-company-apps/my-company-monolith $ mvn spring-boot:run
$ cd my-company-backend/my-company-apps/my-company-microservices/my-company-configuration-backingservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-registry-backingservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-blog-domain-microservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-blog-materialized-view-microservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-project-domain-microservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-project-materialized-view-microservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-api-gateway-backingservice $ mvn spring-boot:run $ cd my-company-backend/my-company-apps/my-company-microservices/my-company-adminserver-backingservice $ mvn spring-boot:run