Simple app that has main server that receives HTTP request for all CRUD operations for manipulation with accounts.
curl -H 'Content-type: application/json' localhost:8080/accounts
curl -X POST -H 'Content-type: application/json' -d '{"owner":"boki","balance":100}' localhost:8080/accounts
curl -H 'Content-type: application/json' localhost:8080/account/{ownerName}
curl -X DELETE -H 'Content-type: application/json' localhost:8080/account/{ownerName}
---- Creation of new transaction ----- We will simulate sending money from one account to another. curl -X POST -H 'Content-type: application/json' -d '{"sender":"boki","amount":29,"receiver":"john"}' localhost:8080/transactions Amount of money should be subtracted from sender's balances, and added to receiver. Only condition is that sender has enough of money on account. At the same time, new transaction record is created and pushed to Redis MSQ. Another application transactions waits for new messages on redis msq channel, once the transaction occurs, it's record is saved to separated database schema. In that way we created asychronous communication between (micro)services, so the latency is reduced... _What is left to do: Once the transaction is saved in DB and received ID, send it back to 'accounts' service, using another channel, or the same one. _
migrate create -ext sql -dir db/migration -seq init_schema
docker-compose up --build