# Context-Aware System for Information Flow Management in Factories of the Future
## 3 Context-Aware Application
### Implementation and Integration Technologies  
The selected technology to implement the Context Engine is a microservices' based approach. This decision was supported by the widespread popularity of the technology, as evidenced in the consulted articles and recommendations from their authors [34]. Additionally, microservices exhibit crucial characteristics such as flexibility, modularity, and independent evolution [29], considered highly important for application prototypes due to their adaptability to changes and independent evolution.  
Another crucial feature influencing the selection of this technology was the ability to perform implementations through APIs. This facilitates interaction and integration among different software components, enabling efficient communication between various services, a key requirement for this application.  
To establish communication and integration with external applications or devices, and considering that the application was developed using microservices, the approach chosen to perform this task was to use the REST API programming interface. This choice enables integration between the various components, using the HTTP protocol to carry out communication tasks. This approach allows different components of the system to communicate efficiently and flexibly, facilitating the exchange of information and collaboration between services.  
Figure 3 demonstrates the integration and communications used by the application.  
After the development of the _Context Engine_ architecture, it was observed that its internal components do not need to communicate with each other. They will only exchange data with external applications or with the application's own database. Therefore, it was not necessary to implement communications or integration between these components.  
The communications that the application establishes with other external applications are as follows:  
1. The application can receive information through the integration layer. To do this, the components that need this data (Context Server and Context Acquisition) must use the DataServices interface. This data is obtained via HTTP GET requests and the information is received in JSON format. In addition, the application can receive data from other applications in the CA-FoFS system, an operation that takes place in the Context Builder. This receives HTTP POST requests with data in JSON format, managing this data according to the service task and returning an HTTP status code indicating the result of the request received.
2. The application can also send information to other external applications. For this to happen, the application must receive a request for information, which is the responsibility of the Context Server component. This receives HTTP GET requests from the service layer, providing an HTTP response with the content of the response in JSON format and the HTTP status code, according to the functionality of the service and the input parameters received. In addition, the application can send alerts to the NAS, which are sent via HTTP POST requests with the information in JSON in the content of the message.