This project includes two components: a processor and a producer. The processor consumes messages from a Kafka topic (iot-stream), classifies sensor data (temperature and humidity), and writes the results to AWS Timestream. The producer generates 200 random sensor readings and publishes them to a NATS server.
- Python 3.7+ installed.
- Install required libraries:
pip install kafka-python boto3 nats-py
- Ensure:
- A Kafka server is running and accessible.
- A NATS server is running locally at
nats://localhost:4222. - AWS credentials and Timestream database/table are configured.
-
Start the Processor:
- Run the script:
python processor.py
- Run the script:
-
Run the Producer:
- Run the script:
python producer.py
- Run the script:
Ensure the processor is running before starting the producer.
- The producer sends sensor readings to the NATS server.
- The processor consumes the data from Kafka, processes it, and writes classified results to AWS Timestream.
- Modify device IDs or data ranges in the producer to simulate different scenarios.
- Check logs for both scripts to ensure proper operation.
Lucien Chemaly