Aggregate sensors ping metrics and query in real time
The separate README.md files are present in each language implementation folder of the project.
-
For understanding the algorithm and the approach, please refer to the Pings_Processor_Architecture_Document file in the generic-ping-aggregator folder.
-
For running the project, please refer to the README.md file in each language implementation folder.
-
For API documentation, please refer to the below section.
-
For testing the API, please refer to the below section.
-
For code walkthrough, please refer to the Pings_Processor_Architecture_Document file in the generic-ping-aggregator folder.
Sends a ping to the service for the given sensorID. This increments the frequency of the sensor in the system.
- Method: POST
- URL: /api/sensors/ping
- Query Parameter: sensorID (ID of the sensor sending the ping)
- Status: 200 OK
- Body:
{
"message": "Ping processed for sensor ID: 1"
}
curl -X POST "http://localhost:8080/api/sensors/ping" -H "Content-Type: application/json" -d '{"sensorID": 1}'
Retrieves the sensor ID that has the highest number of pings in the last k events.
- Method: GET
- URL: /api/sensors/top-frequency-sensor
- Query Parameter: k (the number of recent pings to consider)
curl -X GET "http://localhost:8080/api/sensors/top-frequency-sensor?k=5"
- Status: 200 OK
- Body:
{
"sensorID": 1
}