You are developing a system for processing data from multiple sensors. Each sensor sends a JSON message with the next string fields in the body: sensor_id, model, and payload. The payload can be modified with 0 or more handlers in your system, and then the modified payload should be stored in 0 or more available outputs. Handlers are applied sequentially, the result is written to outputs independently.
Your service should be configured so that for each sensor model it would be possible to determine which handlers should be applied and in which outputs the result should be saved. Please note that the sensor model can have only one configuration.
"sensor_id": "some uuid",
"model": "Sensor 1",
"payload": "some data"
Implement the service from the task description. Pass the message as the first command line argument.
trim — remove whitespace from both ends of the payload;
Payload: " asd "
Output payload: "asd"
padToMultiple — pad the payload on the right with a configured character to a length that is a multiple of some configured N;
Char = #, N = 5
Output payload: "asdasd####"
addTimestamp — add a current timestamp in seconds to the payload.
Output payload: "asd_1630932706"
File — write the result to the configured file;
Console — output the result to the console.