# Investigation of Microservice-Based Workflow Management Solutions for Industrial Automation
## 4 Strategies for Workflow Management in a Microservice Architecture
### Node-RED Workflow Manager  
Node-RED is an open-source flow-based programming tool for integrating APIs, hardware devices, and web services into the IoT [74]. It provides a web browser-based flow editor; its core is built on Node.js and its flows are represented in the JSON format. Due to its open-source nature, we have implemented a Node-RED Workflow Manager tool (Node-RED WM) that is easily deployable in an embedded system [75]. The Node-RED WM mainly addresses the deployment and execution stages of the workflow engineering lifecycle. Node-RED WM offers a set of rest endpoints for managing the uploading of recipes in the BPMN format, their instantiation, and their execution. First, the Node-RED WM uploads a BPMN file through its _upload_recipe_ endpoint. The BPMN recipe has to be created beforehand using other tools. Once the BPMN file is uploaded, the system stores it in a database and ensures it is available for execution through its _/start_process_ endpoint. By invoking the endpoint and selecting the process recipe, an instance of the process will be executed. These endpoints are represented in Figure 7 together with the internal modules necessary to process each workflow task. A process can be launched multiple times and executed in multiple instances simultaneously. To do this, the Node-RED WM creates separated instances of the same process model and assigns a unique identifier to each instance. Several recipes can be uploaded simultaneously, enabling the orchestration of different processes at the same time. Workflows in execution are orchestrated by reading the BPMN file structure and requesting those services written in the BPMN process. The Node-RED WM reads the most relevant BPMN elements for process orchestration: the _startEvent_ node to launch the process, the _sequenceFlow_ elements to connect tasks, the _parallelGateway_ to merge and split the process into branches, the _intermediateCatchEvent_ elements to wait for events, the _serviceTask_ to invoke service tasks, etc. In this way, Node-RED WM manages the process by controlling which task node is next in the flow until it reaches the BPMN _endEvent_ node. This alternative enables the deployment of a workflow orchestrator in an embedded system such as an Arduino or Raspberry Pi. When compared to the WSO2 alternative, it consumes few resources, although its monitoring and control execution capabilities are currently limited. Node-RED WM can orchestrate only service-oriented tasks. Workflows in the BPMN format must be designed using BPMN modeling tools, but they are easily deployed and run using the REST endpoints created for that purpose. This solution enables  
Figure 7: Node-RED Workflow Manager endpoints and modules [75]. the management of multiple processes and instances simultaneously. Parallelism and concurrency are managed using IDs for each process instance and task. The status of each flow and its active task is managed using a database. The process architecture and behavior are conditioned by the service that is to be orchestrated. Node-RED WM can be employed to manage different architectures and flow conditions, although more BPMN elements need to be implemented for complete BPMN element coverage. Node-RED WM can also accommodate services with an asynchronous nature. Still, further improvements are necessary to cover the entire engineering lifecycle of the process. BPMN recipe modeling is performed using other tools and monitoring needs to be improved to enable a visual dashboard where one can track each process execution. As presented above, the main advantage of this alternative is that it can be run in an embedded system. Although the technology readiness level of this workflow manager alternative is low, Node-RED offers the potential to enrich the solution by (1) accommodating other types of data formats or recipes; (2) integrating other frameworks and systems such as message brokers, databases, and protocols (OPC-UA); or (3) collaborating with other alternatives such as WSO2.