Merge branch 'master' into wip-eventuate-client-java

Conflicts:
	java-spring/monolithic-service/build.gradle
	java-spring/monolithic-service/src/main/java/net/chrisrichardson/eventstore/javaexamples/banking/web/BankingWebConfiguration.java
This commit is contained in:
Chris Richardson
2016-09-06 21:51:17 -07:00
6 changed files with 30 additions and 12 deletions

View File

@@ -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.
@@ -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.
@@ -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.

View File

@@ -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
@@ -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

View File

@@ -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

View File

@@ -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"
@@ -27,4 +28,4 @@ task copyWebStatic(type: Copy) {
}
jar.dependsOn(copyWebStatic)
bootRun.dependsOn(copyWebStatic)
bootRun.dependsOn(copyWebStatic)

7
java-spring/show-urls.sh Executable file
View File

@@ -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

View File

@@ -13,6 +13,7 @@ while [[ "$done" = false ]]; do
done=true
else
done=false
break
fi
done
if [[ "$done" = true ]]; then