2019-12-29 10:03:31 +01:00
2019-12-26 10:54:44 +01:00
2019-12-29 10:03:31 +01:00
2019-12-29 10:03:31 +01:00
2019-12-26 16:44:26 +01:00
2019-04-23 16:40:49 +02:00
2019-12-26 10:54:44 +01:00
2019-12-26 10:54:44 +01:00
2019-12-28 17:56:19 +01:00
2019-12-29 10:03:31 +01:00
2019-12-29 09:17:16 +01:00

ddd-cqrs-4-java-example

Example applications that use ddd-4-java and cqrs-4-java libraries and an EventStore to store the events (Event Sourcing).

Components

Shared

Common code for all demo applications (commands, events, value objects and utilities). More...

Aggregates

DDD related code for all demo applications (aggregates, entities and business exceptions). More...

Java SE + CDI

Two standalone applications (Command & Query) using CDI for dependency injection. More...

Quarkus

Two web applications (Command & Query) based on Quarkus. More...

Spring Boot

Two web applications (Command & Query) based on Spring Boot. More...

Getting started

Prerequisites

Make sure you have the following tools installed/configured:

Or simply use the lubuntu-developer-vm that has already everything installed. Then execute the following steps:

  1. Download and install the developer VM as described
  2. OPTIONAL: Change memory of VM to 6 GB (instead of 4 GB default) if you want to create a native image with GraalVM
  3. Start the VM and login (developer / developer)
  4. Open a console (Shortcut = ctrl alt t)
  5. Run a small script that finalizes the setup of the developer virtual machine
    bash <(curl -s https://raw.githubusercontent.com/fuinorg/ddd-cqrs-4-java-example/master/setup-lubuntu-developer-vm.sh)
    

Clone and install project

  1. Open a console (Ubuntu shortcut = ctrl alt t)
  2. Clone the git repository
    git clone https://github.com/fuinorg/ddd-cqrs-4-java-example.git
    
  3. Change into the project's directory and run a Maven build
    cd ddd-cqrs-4-java-example
    ./mvnw install
    

Start Event Store and Maria DB

  1. Open a console (Ubuntu shortcut = ctrl alt t)
  2. Change into the project's directory and run Docker Compose
    cd ddd-cqrs-4-java-example
    docker-compose up
    

Start command / query implementations

Start one command and one query microservice.

Test

  1. Open http://localhost:2113/ to access the event store UI (User: admin / Password: changeit)
  2. Opening http://localhost:8080/persons should show an empty JSON array
  3. Open a console (Ubuntu shortcut = ctrl alt t)
  4. Change into the demo directory and execute a command using cURL (See shell script and command)
    cd ddd-cqrs-4-java-example/demo
    ./create-person-command.sh
    
    Command console should show something like
    Update aggregate: id=PERSON 84565d62-115e-4502-b7c9-38ad69c64b05, version=-1, nextVersion=0
    
    Query console should show something like
    PersonCreatedEventHandler ... Handle PersonCreatedEvent: Person 'Peter Parker' was created
    
  5. Refreshing http://localhost:8080/persons should show
    [{"id":"84565d62-115e-4502-b7c9-38ad69c64b05","name":"Peter Parker"}]
    
  6. Opening http://localhost:8080/persons/84565d62-115e-4502-b7c9-38ad69c64b05 should show
    {"id":"84565d62-115e-4502-b7c9-38ad69c64b05","name":"Peter Parker"}
    
    

Stop Event Store and Maria DB and clean up

  1. Stop Docker Compose (Ubuntu shortcut = ctrl c)
  2. Remove Docker Compose container
    docker-compose rm
    
Description
Example Java DDD/CQRS/Event Sourcing microservices with Quarkus, Spring Boot and EventStore from Greg Young.
Readme 1.2 MiB
Languages
Java 99.2%
HTML 0.8%