There is a warehouse equipped with various types of sensors that monitor environmental conditions. These sensors provide measurements such as current temperature and humidity, which are transmitted via UDP. The warehouse service interacts with all these sensors and automatically publishes the measurements to a central monitoring service. This service oversees multiple warehouses and activates an alarm if temperature or humidity readings exceed configured thresholds.
- Java 17
- Maven
- SpringBoot
- Kafka
- Docker and docker-compose
- Sensor Types: Temperature, Humidity.
- Communication: Measurements are sent via UDP.
- Central Service Features: Threshold monitoring, alarm activation.
Threshold values can be configured in central-monitoring-service application.yaml
The default value for humidity is 50 and for temperature 35
UDP ports to listen can be configured in warehouse-service application.yaml
The default port for humidity is 3355 and for temperature 3344
After starting the warehouse-service and central-monitoring-service, we can execute the commands below to test the implementation:
echo "sensor_id=t1; value=40" | nc -u -w1 127.0.0.1 3344will display an alert in the console for exceeding threshold.echo "sensor_id=t1; value=30" | nc -u -w1 127.0.0.1 3344will not display any alert as it does not exceed the threshold.
echo "sensor_id=h1; value=60" | nc -u -w1 127.0.0.1 3355will display an alert in the console for exceeding threshold.echo "sensor_id=h1; value=40" | nc -u -w1 127.0.0.1 3355will not display any alert as it does not exceed the threshold.
Tests are available and can be run in this package or simply run mvn test