Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bitxon/java-microservices

Compare: Spring, Quarkus, Micronaut, Dropwizard
https://github.com/bitxon/java-microservices

dropwizard java micronaut quarkus spring-boot test-containers

Last synced: 2 days ago
JSON representation

Compare: Spring, Quarkus, Micronaut, Dropwizard

Awesome Lists containing this project

README

        

# Java Microservices

- [Dropwizard](dropwizard-app/README.md)
- [Spring](spring-app/README.md)
- [Micronaut](micronaut-app/README.md)
- [Quarkus](quarkus-app/README.md)

# Description
This project is a comparison of Java frameworks.
All applications implement the same functionality and expose the same REST api

# Quick start

1. Build
- `./gradlew clean build`
2. Spin Up Postgres & Wiremock:
- `docker-compose up -d`
3. Start one of the Apps:
- `./run-dropwizard.sh`
- `./run-spring.sh`
- `./run-micronaut.sh`
- `./run-quarkus.sh`
4. Run Gatling:
- `./gradlew :loadtest:gatlingRun --simulation gatling.simulation.AppSimulation`

Check wiremock performance

1. Spin Up Wiremock:
- `docker-compose up -d wiremock`
4. Run Gatling:
- `./gradlew :loadtest:gatlingRun --simulation gatling.simulation.WiremockSimulation`

# Rest API

GET /accounts - Get all accounts

Request Body:
```
N/A
```

Response Body:
```json
[
{
"id": 1,
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "2000-03-17",
"currency": "USD",
"moneyAmount": 78
}
]
```

GET /accounts/{id} - Get account by ID

Request Body:
```
N/A
```

Response Body:
```json
{
"id": 1,
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "2000-03-17",
"currency": "USD",
"moneyAmount": 78
}
```

POST /accounts - Create new account

Request Body:
```json
{
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "2000-03-17",
"currency": "USD",
"moneyAmount": 78
}
```

Response Body:
```json
{
"id": 1,
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"dateOfBirth": "2000-03-17",
"currency": "USD",
"moneyAmount": 78
}
```

POST /accounts/transfer - Transfer money from one account to another

Request Header: (is being used to fail operation and check that transaction works)
```
Dirty-Trick-Header: FAIL_TRANSFER
```

Request Body:
```json
{
"senderId": 1,
"recipientId": 2,
"moneyAmount": 100
}
```

Response Body:
```
N/A
```

Diagram:

```mermaid
sequenceDiagram
actor User as User
participant App as Application
participant DB as Database
participant Api as Bank Api

User ->> App: POST /transfer
activate App
App ->> DB: Find accounts
deactivate App
activate DB
DB -->> App: Accounts
deactivate DB
activate App
App ->> Api: GET /exchange
deactivate App
activate Api
Api -->> App: Exchange rate
deactivate Api
activate App
App ->> App: Update balance of accounts
App ->> DB: Save accounts
deactivate App
activate DB
DB -->> App: Done
deactivate DB
activate App
App -->> User: Done
deactivate App
```