Java version of the Customers and Orders event sourcing example from my presentations
Java Shell Groovy
Permalink
Failed to load latest commit information.
backend-integration-test - moved the project to the new eventuate-java-client Jul 29, 2016
buildSrc/src/main/groovy - fixed gradle build scripts Sep 28, 2016
common-swagger Improved instructions, upgraded to latest client, fixed Swagger misco… Sep 17, 2016
common-test changed log level for "io.eventuate.activity" logger, removed redunda… Oct 10, 2016
common Merge branch 'master' of github.com:eventuate-examples/eventuate-exam… Jan 1, 2017
customers-command-side-backend Fixed typo in event name Jan 1, 2017
customers-command-side-service - converted all docker-compose files to use build: rather than volume… Oct 12, 2016
customers-command-side-web - moved the project to the new eventuate-java-client Jul 29, 2016
e2e-test removed redundant eventuate-client-java-jdbc dependency Oct 20, 2016
gradle/wrapper added support for Eventuate Local Sep 27, 2016
order-history-query-side-backend fixed build.gradle for order-history-query-side-backend Oct 12, 2016
order-history-query-side-service - converted all docker-compose files to use build: rather than volume… Oct 12, 2016
order-history-query-side-web - moved the project to the new eventuate-java-client Jul 29, 2016
orders-command-side-backend Fixed typo in event name Jan 1, 2017
orders-command-side-service - converted all docker-compose files to use build: rather than volume… Oct 12, 2016
orders-command-side-web - moved the project to the new eventuate-java-client Jul 29, 2016
web-test - moved the project to the new eventuate-java-client Jul 29, 2016
.gitignore Initial checkin Sep 6, 2015
README.md Added link to guide to setting DOCKER_HOST_IP Nov 17, 2016
_build-and-test-all.sh - converted all docker-compose files to use build: rather than volume… Oct 12, 2016
build-and-test-all-eventuate-local.sh updated build-and-test-all-eventuate-local file: now it's possible to… Oct 3, 2016
build-and-test-all.sh added support for Eventuate Local Sep 27, 2016
build.gradle Initial version Jun 23, 2016
docker-compose-common.yml - converted all docker-compose files to use build: rather than volume… Oct 12, 2016
docker-compose-eventuate-local.yml added support for Eventuate Local Sep 27, 2016
docker-compose.yml - fixed docker-compose script Sep 28, 2016
gradle.properties added support for Eventuate Local Sep 27, 2016
gradlew Initial version Jun 23, 2016
gradlew.bat Initial version Jun 23, 2016
mongodb-cli.sh Initial version Jun 23, 2016
set-env.sh -fixed OrderHistoryViewConfiguration Sep 29, 2016
settings.gradle - added e2e-tests Aug 1, 2016
show-urls.sh Improved instructions, upgraded to latest client, fixed Swagger misco… Sep 17, 2016
wait-for-services.sh Fixed bug in ./wait-for-services.sh Jan 1, 2017

README.md

This is the Java version of the customers and orders example that I've used in numerous presentations on developing microservices with event sourcing and CQRS. The code is built using the Eventuate platform. It illustrates how to implement an eventually consistent credit limit check using event sourcing. For more information, see this presentation from Gluecon 2016

About Eventuate™

The application is built using Eventuate, which is an application platform for writing transactional microservices. It provides a simple yet powerful event-driven programming model that is based on event sourcing and Command Query Responsibility Segregation (CQRS). Eventuate solves the distributed data management problems inherent in a microservice architecture. It consists of a scalable, distributed event store and client libraries for various languages and frameworks including Java, Scala, and the Spring framework.

There are two versions of Eventuate:

Building and running the application.

This is a Java 8, Gradle project. However, you do not need to install Gradle since it will be downloaded automatically. You just need to have Java 8 installed.

The details of how to build and run the services depend slightly on whether you are using Eventuate SaaS or Eventuate Local.

Building and running using Eventuate SaaS

First, must sign up to get your credentials in order to get free access to the SaaS version.

Next, build the application:

./gradlew assemble

Next, you can launch the application using Docker Compose

docker-compose up -d

Finally, you can use the Swagger UI provided by the services to create customers and orders, and view the order history:

  • http://${DOCKER_HOST_IP?}:8081/swagger-ui.html - Create a customer
  • http://${DOCKER_HOST_IP?}:8083/swagger-ui.html - Create an order
  • http://${DOCKER_HOST_IP?}:8082/swagger-ui.html - View the customer and the order

(Hint: best to open these URLs in separate tabs)

Note: DOCKER_HOST_IP is the IP address of the machine running the Docker daemon.

Building and running using Eventuate Local

First, build the application:

./gradlew assemble -P eventuateDriver=local

Next, you can launch the application using Docker Compose

export DOCKER_HOST_IP=...
docker-compose -f docker-compose-eventuate-local.yml up -d

Note: You need to set DOCKER_HOST_IP before running Docker Compose. DOCKER_HOST_IP is the IP address of the machine running the Docker daemon. It must be an IP address or resolvable hostname. It cannot be localhost. See this guide to setting DOCKER_HOST_IP for more information.

Finally, you can use the Swagger UI provided by the services to create customers and orders, and view the order history:

  • http://${DOCKER_HOST_IP?}:8081/swagger-ui.html - Create a customer
  • http://${DOCKER_HOST_IP?}:8083/swagger-ui.html - Create an order
  • http://${DOCKER_HOST_IP?}:8082/swagger-ui.html - View the customer and the order

(Hint: best to open these URLs in separate tabs)