# Investigation of Microservice-Based Workflow Management Solutions for Industrial Automation
## 4 Strategies for Workflow Management in a Microservice Architecture
### Workflow Choreographer  
The Workflow Choreographer is proposed to execute workflows based on predefined templates according to specific production processes. Based on the incoming production order, the Workflow Choreographer creates the so-called production recipe [64] and instantiates the production workflow. The production recipe uses predefined templates, which the operators must define according to the particular workflow. Based on the production steps, the Workflow Choreographer creates the workstation-specific Workflow Executors (see Section 4.1), which execute the associated workflows on the given workstation accordingly. From an architectural perspective, the Workflow Choreographer sends requests to the Orchestration system, which is a core Arrowhead system [5], for the services that are required to execute the production recipe and subscribes to the related events provided by the Event Handler, which is an Arrowhead support system [65]. In addition, it communicates with the instantiated Workflow Executors. Based on the feedback service events from the Event Handler or the Workflow Executor, the Choreographer moves the workflow to the next appropriate step, according to the given recipe [66]. At the end of the workflow, it releases the reserved services, as shown in Figure 5.  
The main novelty of the approach is that it also introduces the concept of multi-level workflow execution, in which the enterprise and production levels are separated [67]. A specific feature of the multi-level model is that the two levels use different modeling languages in parallel--BPMN [68] for the enterprise level and Colored Petri Net (CPN) [69] for the production level--thus the multi-level model retains their advantages and eliminates their disadvantages [67]. This separation was necessary to ensure the production workflows are transparent for operators while meeting the technical requirements of the identified core functions in line with Industry 4.0 expectations [67]. The two modeling languages are managed together at the program code level; this requires the creation and use of libraries that provide the syntax for the respective modeling languages that follow the programming language of Arrowhead. Through the Arrowhead Management User Interface, workflows corresponding to BPMN objects can be graphically created using the production templates previously defined by operators. In these production templates, logic is implemented based on the CPN syntax [69]. To prove the concept, a reference implementation with the integration of several external solutions has been created [67], which is described in detail in Section 4.3. The reference implementation is written in Java, which is also the reference language for Arrowhead, and uses the Representational state transfer (REST) protocol for communication with external solutions. The reference implementation is also connected to the Arrowhead framework, which provides all the resources and functionality required for the Workflow Choreographer to work. Since the workflow modeling has been carried out at the program code level, both synchronous and asynchronous operations can be achieved; furthermore, human-specific tasks can also be executed due to the BPMN syntax. Further, a system development methodology was also defined during the development of the Workflow Choreographer based on widely accepted standards and industry best practices [70]. This provides guidance for developing systems to be built into SOA-based SoS environments. Furthermore, based on the reference implementation, a prototype Workflow Choreographer was created and successfully tested under laboratory conditions [66]. An important difference from the concept presented earlier in Section 4.1 is that, in the case of the Workflow Choreographer, the Workflow Executors are always created for the task to be executed; therefore, the Workflow Executors are not pre-programmed and immutable supporting core systems.