Skip to content

Commit

Permalink
Merge branch 'master' into wip-eventuate-client-java
Browse files Browse the repository at this point in the history
Conflicts:
	java-spring/monolithic-service/build.gradle
	java-spring/monolithic-service/src/main/java/net/chrisrichardson/eventstore/javaexamples/banking/web/BankingWebConfiguration.java
  • Loading branch information
cer committed Sep 7, 2016
2 parents c03a5fe + d0bdd51 commit 8ae6db7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Event-Sourcing+CQRS example application

This example application is the money transfer application described in my talk [Building and deploying microservices with event sourcing, CQRS and Docker](http://plainoldobjects.com/presentations/building-and-deploying-microservices-with-event-sourcing-cqrs-and-docker/).
This talk describe a way of architecting highly scalable and available applications that is based on microservices, polyglot persistence,
This talk describes a way of architecting highly scalable and available applications that is based on microservices, polyglot persistence,
event sourcing (ES) and command query responsibility segregation (CQRS).
Applications consist of loosely coupled components that communicate using events.
These components can be deployed either as separate services or packaged as a monolithic application for simplified development and testing.
Expand Down Expand Up @@ -94,9 +94,12 @@ First, you need to tell the query side code how to connect to MongoDB:
```

[Docker Compose](https://docs.docker.com/compose/) is a great way to run MongoDB.
You can run the `docker-compose up -d mongodb` to run MongoDB.
You can run the `docker-compose up -d mongodb` to run MongoDB and then set `SPRING_DATA_MONGODB_URI` as follows:
```
export SPRING_DATA_MONGODB_URI=mongodb://$(docker-machine ip default)/yourdb
```

Second, some of the tests in accounts-command-side-service, transactions-command-side-service, accounts-query-side-service and e2e-test need you need to set some environment variables that tell them how to connect to the Event Store server.
Second, some of the tests in accounts-command-side-service, transactions-command-side-service, accounts-query-side-service and e2e-test require you to set some environment variables that tell them how to connect to the Event Store server.
But don't worry.
The build is configured to ignore failures for those projects.

Expand All @@ -117,6 +120,15 @@ Simply use this command:
java -jar monolithic-service/build/libs/monolithic-service.jar
```

This will start the service running on port 8080 (you can change using the --server.port=9999 option).

Once the service has started you can open the Swagger UI: http://localhost:8080/swagger-ui.html.
You can then:

1. Create two accounts (save the account ids)
2. Create a money transfer
3. View the updated account balances

## Running the microservices

The other option is to run the services separately.
Expand Down
10 changes: 4 additions & 6 deletions java-spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ This application consists of three microservices:
* Account Service - the command side business logic for Accounts
* Money Transfer Service - the command side business logic for Money Transfers
* Query service - query side implementation of a MongoDB-based, denormalized view of Accounts and MoneyTransfers

The Account Service consists of the following modules:

* accounts-command-side-backend - the Account aggregate
* accounts-command-side-web - a REST API for creating and retrieving Accounts
* accounts-command-side-service - a standalone microservice

The Money Transfer Service consists of the following modules:

* transactions-command-side-backend - the MoneyTransfer aggregate
* transactions-command-side-web - a REST API for creating and retrieving Money Transfers
* transactions-command-side-service - a standalone microservice

The Query Service consists the following modules:

* accounts-query-side-backend - MongoDB-based, denormalized view of Accounts and MoneyTransfers
Expand All @@ -28,10 +28,8 @@ The Query Service consists the following modules:

# Deploying the application

These services can be deployed either as either separate standalone services using the Event Store server, or they can be deployed as a monolithic application for simpified integration testing.
These services can be deployed either as either separate standalone services using the Event Store server, or they can be deployed as a monolithic application for simplified integration testing.

The three services can also be packaged as a single monolithic web application in order to be used with the embedded Event Store:

* monolithic-service - all-in-one, monolithic packaging of the application


3 changes: 1 addition & 2 deletions java-spring/mongodb-cli.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#! /bin/bash

docker run --link javaspring_mongodb_1:mongodb -i -t mongo:3.0.4 /usr/bin/mongo --host mongodb

docker run --rm --link javaspring_mongodb_1:mongodb -i -t mongo:3.0.4 /usr/bin/mongo --host mongodb
3 changes: 2 additions & 1 deletion java-spring/monolithic-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies {
compile "org.springframework.boot:spring-boot-starter-actuator"

compile "io.eventuate.client.java:eventuate-client-java-http-stomp-spring:$eventuateClientVersion"
compile project(":common-swagger")

testCompile project(":testutil")
testCompile "org.springframework.boot:spring-boot-starter-test"
Expand All @@ -27,4 +28,4 @@ task copyWebStatic(type: Copy) {
}

jar.dependsOn(copyWebStatic)
bootRun.dependsOn(copyWebStatic)
bootRun.dependsOn(copyWebStatic)
7 changes: 7 additions & 0 deletions java-spring/show-urls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash -e

IP=$(docker-machine ip default)

echo Accounts command-side service = http://${IP}:8080/swagger-ui.html
echo Money Transfers command-side service = http://${IP}:8082/swagger-ui.html
echo Accounts query-side service = http://${IP}:8081/swagger-ui.html
1 change: 1 addition & 0 deletions wait-for-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ while [[ "$done" = false ]]; do
done=true
else
done=false
break
fi
done
if [[ "$done" = true ]]; then
Expand Down

0 comments on commit 8ae6db7

Please sign in to comment.