Skip to content

ferpotenUCLM/DistributedSystems

Repository files navigation

Distributed Calculator with Ice and Kafka

License: MIT Python Version Kafka Ice

This project implements a distributed calculator using ZeroC Ice for RPC and Apache Kafka for asynchronous message handling. The system allows clients to submit mathematical operations through Kafka, which are processed by an Ice server via a gateway, with results returned via Kafka.

Key Features

  • 🧮 Basic math operations: addition, subtraction, multiplication, division
  • ⚡ Asynchronous communication through Kafka
  • 🛡️ Error handling (including division by zero)
  • 📦 Modular and extensible architecture
  • 🚀 Easy deployment and configuration

Quick Installation

  1. Clone the repository:
git clone https://github.com/your-user/distributed-calculator.git
cd distributed-calculator
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure Kafka (create the necessary topics):
.\bin\windows\kafka-topics.bat --create --topic calculator_requests --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
.\bin\windows\kafka-topics.bat --create --topic calculator_responses --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1

Basic Usage

  1. Start the Ice server:
python server.py
  1. Start the Kafka-Ice gateway:
python gateway.py
  1. Send an operation:
echo {"id":"req1","operation":"sum","args":{"op1":5.0,"op2":3.0}} | .\bin\windows\kafka-console-producer.bat --topic calculator_requests --bootstrap-server localhost:9092
  1. View the results:
.\bin\windows\kafka-console-consumer.bat --topic calculator_responses --bootstrap-server localhost:9092 --from-beginning

Request Format

{
"id": "unique-identifier",
"operation": "sum|sub|mult|div",
"args": {
"op1": 5.0,
"op2": 3.0
}
}

Supported Operations

Operation Name in JSON
Addition sum
Subtraction sub
Multiplication mult
Division div

Complete Documentation

For advanced configuration, troubleshooting, and implementation details, see the Project Wiki.

Open Page.

License

This project is licensed under the MIT License.


requirements.txt

confluent-kafka==2.3.0
zeroc-ice==3.7.10

About

Repositorio Practicas Sistemas Distribuidos UCLM 2024

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published