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.
- 🧮 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
- Clone the repository:
git clone https://github.com/your-user/distributed-calculator.git
cd distributed-calculator- Install dependencies:
pip install -r requirements.txt- 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- Start the Ice server:
python server.py- Start the Kafka-Ice gateway:
python gateway.py- 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- View the results:
.\bin\windows\kafka-console-consumer.bat --topic calculator_responses --bootstrap-server localhost:9092 --from-beginning{
"id": "unique-identifier",
"operation": "sum|sub|mult|div",
"args": {
"op1": 5.0,
"op2": 3.0
}
}| Operation | Name in JSON |
|---|---|
| Addition | sum |
| Subtraction | sub |
| Multiplication | mult |
| Division | div |
For advanced configuration, troubleshooting, and implementation details, see the Project Wiki.
This project is licensed under the MIT License.
confluent-kafka==2.3.0
zeroc-ice==3.7.10