β οΈ This repository was created to practice using Kafka and is not code to be used in production.
Every time a financial transaction is created it must be validated by our anti-fraud microservice and then the same service sends a message back to update the transaction status. For now, we have only three transaction statuses:
- pending
- approved
- rejected
Every transaction with a value greater than 1000 should be rejected.
- balance the load of insert and update in the database
- Go installed and configured
- Docker and Docker Compose installed
- k6 (optional)
-
Clone repository:
git clone https://github.com/Caixetadev/kafka-transaction-validator.git && cd kafka-transaction-validator
-
Start the services using Docker Compose:
docker compose up
-
Run the
anti-fraud
service:cd anti-fraud && go run cmd/main.go
-
Run the
transaction
service:cd transaction && go run cmd/main.go
-
Access the application at: http://localhost:8080/transaction.
- URL:
/transaction
- Method:
POST
- Request Body:
{ "accountExternalIdDebit": "string", "accountExternalIdCredit": "string", "tranferTypeId": 1, "value": 1 }
k6 run scripts/k6.js