News / All News / Article

Penguin Geeks | Demystifying Workflow Engines: The Technology Behind Enterprise Approval Automation

Article images may contain Chinese text.

Image
1. What Is a Workflow?

A workflow is the automation of part or all of a business process in a computer application environment. It is an abstract, generalized description of a work process and the business rules governing its individual steps.

The main problem a workflow addresses is how to use computers to automatically pass documents, information, or tasks among multiple participants according to predefined rules to achieve a business objective.

Simply put, a workflow is a process-based abstraction of business activities. The WFMC (Workflow Management Coalition) provides the following workflow reference model:

Image

One common workflow use case in office automation (OA) is the approval process. Different business scenarios involve different approval requirements. Developing a separate set of code for every approval workflow would create substantial code redundancy and sharply increase development effort.

This calls for a business-independent, highly abstracted and encapsulated engine to handle these processes in a unified way. The engine allows workflows to be configured flexibly and automatically manages state changes and process transitions according to those configurations. This is a workflow engine.


Image

Image
2. Workflow Designer

In a workflow, the engine executes tasks according to predefined rules. How those tasks are executed must be configured using a workflow designer. A workflow designer is a tool or software application for creating, editing, and managing business processes.

It allows users to intuitively design and simulate business processes through a graphical interface without writing large amounts of code. Workflow designers are widely used in enterprise business process management (BPM), workflow automation, and service orchestration.

With a workflow designer, users can define elements such as individual steps, decision points, participants, and data flows. These tools often provide drag-and-drop components representing different operations, such as task assignment, approval processes, and conditional checks, with connectors showing the relationships and execution order among these elements.

Common Workflow Designers on the Market

01
Traditional Style
BPMN
Image
Image
02
New Style
DingTalk

Feishu

WeCom

Image
Image

Image


Image
3. Workflow Engine Architecture

The architecture can broadly be divided into four parts: the designer, APIs, the core workflow engine, and data persistence.


01
Designer
The workflow designer is used to design workflows and draws on both business data and system data.

    System data primarily comes from the organizational structure. Task assignees and approvers configured for nodes can be selected from that structure.

    Business data primarily consists of selected form data, which can support branching decisions at conditional branch nodes based on the data in the form.

Image
02
APIs
There are generally two types of APIs.
    The first is a RESTful API based on HTTP, providing functions for saving, modifying, and deleting workflow definitions, as well as approval and query capabilities.
    The second consists of Service-based interface classes that can be integrated into the main application, primarily for operations such as initiating approvals.
    Webhook support may be added later, allowing external systems to automatically receive notifications when specific events occur, such as approval completion or task creation, thereby improving integration with other systems.
Image
03
Workflow Engine
First, the designer's format must be parsed into an executable workflow model. The engine's internal services then execute the workflow model step by step.
During execution, approval nodes need to access the system's organizational structure data, while branch decision nodes need to use a rules engine. Special nodes, such as notifications and requests for input, require their respective handlers (Handler). State changes for node tasks, including creation, execution in progress, and completion, require event notifications (Event). Business applications can listen for these events to handle their own subsequent operations.

Image
04
Persistence
Persistence is primarily used to save data and record runtime states, and is integrated throughout the workflow engine's lifecycle. Persisted data can broadly be divided into three categories: workflow definitions, execution instances, and historical records.

Image
Workflow Definitions

A workflow primarily consists of three components: nodes, connectors, and configurations. Once the workflow has been designed in the designer, a parser (Parser) converts its definition in XML, JSON, or another format into a workflow model comprising nodes, connectors, and configurations, and saves it to the relevant database tables.
Image
Execution Instances

When a workflow is created, the program locates the relevant configuration in the workflow definition and generates an instance. A workflow instance can be viewed as a copy of the workflow definition. As the instance runs, operations such as dynamically retrieving approvers, sending back, withdrawing and resubmitting, transferring approval, forwarding, and requesting input may occur. Each of these can lengthen the current instance's workflow.
Image
Historical Records

After a workflow finishes running, the completed workflow can be moved from the execution instance tables to historical record tables. This reduces the volume of execution instance data and helps improve query speed.
Image
A data analytics module could be developed later to uncover the value of historical workflow data and provide management with decision support and data analysis.
Image


The Diagram Below Shows the Architecture of Weiming Penguin's Workflow Engine

Image


Image


Image
4. Workflow Engine Applications: Approvals

The Relationship Between Workflow Engines and Approval Workflows

In enterprise applications, the most common use case for a workflow engine is the approval process.

An approval workflow is a business-logic concept describing a sequence of tasks and decisions to be completed, while a workflow engine is a technical implementation tool that actually executes those tasks and decisions. An approval workflow can be regarded as a specific instance executed by the workflow engine. In particular, when approval steps require human intervention, the workflow engine guides participants through the corresponding approval actions according to the approval workflow's definition and continues to move the process forward.

In approval scenarios, an approval module is usually added as an additional layer outside the workflow engine. This module primarily handles approval-related business logic, such as approval status, processing status, initiator, current approver, current progress, and to-do lists, as well as certain data access permission logic. Handling these functions in the approval module keeps the workflow engine independent and decoupled from business logic. The workflow engine is responsible only for process transitions.

Image


Image


Image
5. Conclusion

In summary, as an important component of enterprise information systems, workflow engines play an irreplaceable role in automating business processes and improving work efficiency. As technology advances, continually optimizing workflow engine architecture not only helps address existing problems, such as poor user experience and difficulty integrating with other systems, but also brings enterprises greater flexibility and capacity for innovation. Through continuous improvement, we believe workflow engines will better support enterprise digital transformation and help companies stand out in intensely competitive markets.


Looking ahead, we will continue to follow the latest technology trends and actively explore ways to integrate cutting-edge technologies such as artificial intelligence and big data with workflow engines, striving to create greater value for customers.


Image