Skip to content

denizque/sensor

Repository files navigation

Project Overview

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.

Tech stack

  • Java 17
  • Maven
  • SpringBoot
  • Kafka
  • Docker and docker-compose

Run docker compose up -d to start the kafka and zookeeper services.

Specifications:

  • 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:

Temperature example:

  • echo "sensor_id=t1; value=40" | nc -u -w1 127.0.0.1 3344 will display an alert in the console for exceeding threshold.
  • echo "sensor_id=t1; value=30" | nc -u -w1 127.0.0.1 3344 will not display any alert as it does not exceed the threshold.

Humidity example:

  • echo "sensor_id=h1; value=60" | nc -u -w1 127.0.0.1 3355 will display an alert in the console for exceeding threshold.
  • echo "sensor_id=h1; value=40" | nc -u -w1 127.0.0.1 3355 will not display any alert as it does not exceed the threshold.

Tests

Tests are available and can be run in this package or simply run mvn test

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages