The banks works as the following the diagram:
All the banks are listening their own queue on the broker. Everytime some transactions comes, they try to resolve it. When the transaction fail, the bank sends a compensation rolling back the transaction to the sender bank.
Before everything, start the rabbit:
./start-rabbit.sh
to create a bank
node src/create-bank.js <bank-name>
to create an account
node src/create-account.js <bank-name>
to transfer between accounts
node src/transfer.js <src-bank> <src-account> <target-bank> <target-account> <value>
You can start a batch listener using
node src/batch-bank.js <bank-name>
You can deposit using
node src/deposit.js <bank-name> <account> <value>
You can withdraw using
node src/withdraw.js <bank-name> <account> <value>