-
Notifications
You must be signed in to change notification settings - Fork 78
Home
This is not a full-fledged CQRS-application. We have made quite a few simplifications and cut a lot of corners in order to be able to paint the bigger picture without too much code and complicated setup.
This example application shows some ideas and implementation styles we have used when building CQRS/ES-systems for our clients. This includes:
- REST-like API's for receiving commands/querying the system
- Clear separation of the domain model and the data projections used for queries
- Event-sourced aggregate roots
- Handling of long-running processes using Sagas
In order to build and run the example application you need:
- Java 7
- Maven 3.x
The application is a small bookstore where customers can buy books. There is also an admin interface where the owner of the bookstore can 'activate' orders and view the events in the application.
-
Clone the repository
-
Run
mvn clean install
-
Start the order service on port 8070 by running
java -jar order-context-parent/order-application/target/order-application-1.0-SNAPSHOT.jar server order-context-parent/order-application/dev.yml
-
Start the product catalog service on port 8090 by running
java -jar product-catalog-context/target/product-catalog-context-1.0-SNAPSHOT.jar server product-catalog-context/dev.yml
-
Start the shopping service on port 8080 by running
java -jar shopping-context/target/shopping-context-1.0-SNAPSHOT.jar server shopping-context/dev.yml
-
Load sample products into the catalog by running
mvn -pl product-catalog-context exec:java -Dexec.mainClass="se.citerus.cqrs.bookstore.productcatalog.application.TestProductDataImporter" -Dexec.classpathScope="test"
-
Load sample contracts into the order service by running
mvn -pl order-context-parent/order-application exec:java -Dexec.mainClass="se.citerus.cqrs.bookstore.ordercontext.application.TestContractDataImporter" -Dexec.classpathScope="test"
-
Access the bookstore web application at http://localhost:8080/index.html and the order management admin interface at http://localhost:8070/admin.html