This system demonstrates a simple fintech transaction processing system integrated with Apache Kafka. It is designed for efficient handling and processing of transactions.
- Kafka Broker: Handles message queuing and delivery.
- Zookeeper: Coordinates Kafka's distributed systems.
- FastAPI Application: Provides RESTful API endpoints.
- Producer: Sends transactions to Kafka topics.
- Consumer: Processes transactions asynchronously.
-
Transaction Submission:
- Transactions are submitted via a REST API to the
/transaction
endpoint.
- Transactions are submitted via a REST API to the
-
Message Queuing in Kafka:
- Producers send transactions as messages to a specified Kafka topic.
-
Transaction Processing:
- Consumers asynchronously process the messages. This step includes running checks and updating the transaction status.
Ensure the following are installed and configured:
- Kafka and Zookeeper
- Python with FastAPI library
- You can build and run the docker compose file to start the containers using:
docker compose up --build -d
- You can then simulate transactions by running the Python test script:
python3 test.py
- Similarly, you can just run the shell script
run.sh
with the optional--runtest
argument. This will start the containers and run the test script: Ensure therun.sh
script is executable usingRun the scriptchmod +x run.sh
./run.sh --runtest
- This system provides a basic framework for transaction processing. Additional features like error handling, security, and scaling should be implemented based on production requirements.
- Customize the producer and consumer logic to include specific checks and transaction updates as per your use case.