Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to new Eventuate Java Client #46

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -14,6 +14,7 @@ dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"

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

testCompile project(":testutil")
Expand All @@ -27,4 +28,4 @@ task copyWebStatic(type: Copy) {
}

jar.dependsOn(copyWebStatic)
bootRun.dependsOn(copyWebStatic)
bootRun.dependsOn(copyWebStatic)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.HttpMessageConverter;
Expand Down
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