- JDK 21
- Maven 3.8+
- Docker Desktop / Docker Engine
mvn clean install
First of all we need to create the docker network
docker network create banking-netThen we can start all the infrastructure services
docker compose up -dThe next step is to run our microservices:
mvn -pl anti-fraud-service spring-boot:run
mvn -pl bank-account-service spring-boot:run
mvn -pl bank-transfer-service spring-boot:runBefore we try to start a money transfer we need to install the debezium connectors. Execute the following commands:
curl -i -X POST http://localhost:8083/connectors -H "Content-Type: application/json" --data-binary @./transfer-outbox.json
curl -i -X POST http://localhost:8083/connectors -H "Content-Type: application/json" --data-binary @./account-outbox.json
curl -i -X POST http://localhost:8083/connectors -H "Content-Type: application/json" --data-binary @./antifraud-outbox.jsonand verify that the connectors are installed by executing:
curl -s http://localhost:8083/connectorsYou should see the following result:
$ curl -s http://localhost:8083/connectors
["account-outbox","antifraud-outbox","transfer-outbox"]In order to start a money transfer you can call the REST API as below:
curl --location 'http://localhost:8080/banking/transfer' \
--header 'X-CUSTOMER-ID: CC-201' \
--header 'Content-Type: application/json' \
--data '{
"fromAccountId": "ACC-101",
"toAccountId": "ACC-201",
"amount": 10000,
"currency": "EUR"
}'
The response body includes the transfer identifier, you can use later to get the current transfer status by making a GET request to the API as below:
transferId="THE TRANSFER ID VALUE"
curl --location http://localhost:8080/banking/transfer/${transferId}You can try to cancel the transfer by executing:
transferId="THE TRANSFER ID VALUE"
curl --location --request POST http://localhost:8080/banking/transfer/${transferId}/cancel \
--header 'X-CUSTOMER-ID: CC-201'