A Python-based Kafka messaging system designed for Raspberry Pi applications. This project provides a robust framework for handling real-time messaging between Raspberry Pi devices and other systems using Apache Kafka.
- Kafka Producer: Sends messages and commands to Kafka topics
- Kafka Consumer: Receives and processes messages from Kafka topics
- Command Handler: Extensible command processing system
- Status Management: Real-time status monitoring and reporting
- Configuration Management: Dynamic configuration updates
- Action Execution: Remote action execution capabilities
- Python 3.7+
- Apache Kafka server
- Raspberry Pi (or any Python-compatible device)
- Clone the repository:
git clone https://github.com/shivamskr151/Raspberry-Pi-Kafka.git
cd Raspberry-Pi-Kafka- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtUpdate the Kafka configuration in kafka_config.py:
KAFKA_BOOTSTRAP_SERVERS = ['localhost:9092'] # Your Kafka server
TOPIC_NAME = 'raspi-commands' # Your topic namepython raspi_kafka.pyThe system supports various commands:
get_status: Retrieve current system statusset_config: Update system configurationexecute_action: Execute specific actions
from kafka_producer import KafkaMessageProducer
producer = KafkaMessageProducer()
producer.send_command('get_status', {'device_id': 'raspi-001'})Raspi-Kafka/
├── raspi_kafka.py # Main application entry point
├── kafka_producer.py # Kafka message producer
├── kafka_consumer.py # Kafka message consumer
├── kafka_config.py # Configuration settings
├── requirements.txt # Python dependencies
└── README.md # This file
The project follows a modular architecture:
- KafkaMessageProducer: Handles message publishing to Kafka topics
- KafkaMessageConsumer: Manages message consumption and processing
- RaspiKafkaManager: Orchestrates the overall system and command handling
- Command Handlers: Extensible system for processing different command types
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is open source and available under the MIT License.
Shivam Kumar - GitHub
For issues and questions, please open an issue on GitHub.