Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caixetadev/kafka-transaction-validator
🍀 golang-kafka microservice for validating financial transactions, built on an event-driven architecture
https://github.com/caixetadev/kafka-transaction-validator
Last synced: about 1 month ago
JSON representation
🍀 golang-kafka microservice for validating financial transactions, built on an event-driven architecture
- Host: GitHub
- URL: https://github.com/caixetadev/kafka-transaction-validator
- Owner: Caixetadev
- Created: 2024-01-20T03:43:38.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-22T16:09:31.000Z (10 months ago)
- Last Synced: 2024-06-21T15:20:19.570Z (5 months ago)
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🍀 kafka-transaction-validator
> :warning: This repository was created to practice using Kafka and is not code to be used in production.## Problem
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
- rejectedEvery transaction with a value greater than 1000 should be rejected.
![image](https://github.com/Caixetadev/fraud-check-kafka-integration/assets/87894998/36d9501d-fa50-4dce-a84a-79ab46d20b2b)## Adjustments and Improvements
- [ ] balance the load of insert and update in the database
## Requirements
- Go installed and configured
- Docker and Docker Compose installed
- k6 (optional)## How to Run
1. Clone repository:
```bash
git clone https://github.com/Caixetadev/kafka-transaction-validator.git && cd kafka-transaction-validator
```1. Start the services using Docker Compose:
```bash
docker compose up
```2. Run the `anti-fraud` service:
```bash
cd anti-fraud && go run cmd/main.go
```3. Run the `transaction` service:
```bash
cd transaction && go run cmd/main.go
```4. Access the application at: [http://localhost:8080/transaction](http://localhost:8080/transaction).
## API Endpoint
### Create Transaction
- **URL:** `/transaction`
- **Method:** `POST`
- **Request Body:**
```json
{
"accountExternalIdDebit": "string",
"accountExternalIdCredit": "string",
"tranferTypeId": 1,
"value": 1
}## Run k6 test
```bash
k6 run scripts/k6.js
```