The Middleware connects different components or applications with each other. This project uses SOA architecture.
These are the services you can find in this project:
Runner service
The runner service receives the commands to set up the other services
. When the project is initialized, the runner subscribes to a broker
to listen to the client’s orders. The client can start the other services with
customized features and also stop them.
Moonlight service
This service stores the messages, is in charge of the
processing for Moonlight to be able to monitor and finally Moonlight
gives a feedback.
Sensor service
This service manages the data gathering. It gets the sensor's messages.
Thingsboard service
Sends the results and the sensors values to Thingsboard to present them
to the human operator
The services communicate using a unique Data Bus, a singleton class.
The client sends a JSON to the Runner with the list of services and their properties. Here is an example:
{
"services": [
{
"serviceId": "sensorService",
"command": "start",
"serviceType": "sensors",
"connection": {
"type": "mqtt",
"settings": {
"broker": "tcp://stefanschupp.de:1883",
"topic": "institute/thingy/#",
"username": "oihana",
"password": "22oihana22"
}
}
},
{
"serviceType": "moonlight",
"serviceId": "moonlightService",
"command": "stop",
"formula": "import dsl.*
val temp = \"temperature\" greaterThan 10
val humidity = \"humidity\" lessThan 10
val f1 = temp and (eventually(humidity) within interval(0, 1))
or somewhere(humidity)
Specification.formula = f1"
},
{
"serviceId": "thingsboardService",
"command": "start",
"serviceType": "thingsboard",
"connection": {
"type": "mqtt",
"settings": {
"broker": "tcp://thingsboard.stefanschupp.de:1884",
"topic": "v1/devices/me/telemetry"
}
},
"devices": [
{
"identifier": "1",
"accessKey": "v8iK9AKNXuRZNhIrzROu"
},
{
"identifier": "2",
"accessKey": "q1qbXmY3KR51xhD24iHP"
}
]
}
]
}