I added a process layer on previous architecture, this process will be responsible for managing actions as well recordings.

Scheduler, this thread has two double linked lists of tickets, this thickets will be consumed by the threads created using FIFO order. This thread is responsibility to:

  • check database for new recording requests

  • know when has to publish an recording ticket to be consumed

  • create new recordings for each sensor present sensor in action, avoiding duplication.

  • create action tickets, using sensors data from database

Data Fetcher threads will be responsible for consuming record tickets, establish the connection XMPP server, get data from the node and in the end send the received values to Database Handler thread to store in DB.

Action threads, will be responsible for consuming actions tickets, and with the information based on this tickets will verify if the rule matches or not, in case of matching, it will have the task of running the commands specified on tickets.

Database Handler is a thread that has specific functionality, connecting to database and handling query's.

Also i updated the database schema.