This service is part of the Expense Tracker application, responsible for processing and handling expense-related data. It accepts incoming HTTP POST requests, processes the data using a custom service, and produces messages to a Kafka topic. This setup allows the application to handle expense tracking in a scalable and distributed manner.
- Flask Framework: Lightweight and efficient web server for handling API requests.
- Kafka Integration: Produces processed expense data to a Kafka topic for further processing or storage.
- Custom Message Service: Handles the business logic for processing expense data.
- Environment Configuration: Uses environment variables for flexible configuration.
- Backend: Flask (Python)
- Message Broker: Apache Kafka
- Environment Management: Python
dotenv
Before running this microservice, ensure you have the following installed:
- Python 3.8+
- Apache Kafka
- Zookeeper (required for Kafka)
- Docker (optional) for containerization
- pip for Python package management
git clone https://github.com/your-username/expense-tracker-microservice.git
cd expense-tracker-microservice
Create a .env
file in the root directory of the project and add the following environment variables:
SERVER_ADDRESS=<Your Kafka Server Address>
Use pip
to install the required Python packages:
pip install -r requirements.txt
Ensure that Kafka and Zookeeper are running. You can use Docker to set them up quickly:
docker-compose up -d
Start the Flask server:
python app.py
The microservice will run on http://localhost:8010
.
-
POST /v1/ds/message - Accepts a JSON payload with an expense message, processes it, and sends it to the Kafka topic
expense_service
. -
GET / - A simple health check endpoint that returns "Hello, World".
curl -X POST http://localhost:8000/v1/ds/message -H "Content-Type: application/json" -d '{"message": "Sample expense data"}'
Contributions are welcome! Please fork this repository, create a new branch, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any queries or issues, please contact Harsh Kumar at helloharsh51@gmail.com.