Skip to content

harsh-1806/ds-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsService Tracker Service

Overview

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.

Features

  • 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.

Tech Stack

  • Backend: Flask (Python)
  • Message Broker: Apache Kafka
  • Environment Management: Python dotenv

Prerequisites

Before running this microservice, ensure you have the following installed:

Installation

1. Clone the Repository

git clone https://github.com/your-username/expense-tracker-microservice.git
cd expense-tracker-microservice

2. Set Up Environment Variables

Create a .env file in the root directory of the project and add the following environment variables:

SERVER_ADDRESS=<Your Kafka Server Address>

3. Install Dependencies

Use pip to install the required Python packages:

pip install -r requirements.txt

4. Configure Kafka and Zookeeper

Ensure that Kafka and Zookeeper are running. You can use Docker to set them up quickly:

docker-compose up -d

5. Run the Microservice

Start the Flask server:

python app.py

The microservice will run on http://localhost:8010.

API Endpoints

  • 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".

Example Request

curl -X POST http://localhost:8000/v1/ds/message -H "Content-Type: application/json" -d '{"message": "Sample expense data"}'

Contributing

Contributions are welcome! Please fork this repository, create a new branch, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any queries or issues, please contact Harsh Kumar at helloharsh51@gmail.com.

About

Data Science Service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published