Skip to main content

Workflow Engine

What is Workflow Engine?

Workflow Engine is as backbone solution for business process management (BPM) which makes feasible to automate the workflow design by using low-code visual builders. It is based on .NET Framework/.NET Core and JavaScript libraries and also a C# API component to ensure process control. Workflow Engine enables workflow processing and correct integration by providing a graphic designer to create process workflow schemes and at the same time, this software component facilitates the management, execution and visualization of workflow processes.

Integrating Workflow Engine

The Workflow Designer is required only for process design. When a process is executed, the designer becomes optional at the time.

This article outlines the basic actions required to integrate Workflow Engine with a software so let's define the main concepts and principles of operation.

What kind of tasks can be resolved by implementing Workflow Engine?

Workflow Engine can resolve several tasks and issues related to process automation as described below:

  • Parallel and hierarchical process resolution.
  • Workload optimization.
  • Business mission-critical process accomplishment.
  • Process planning, implementation and follow up.

In addition, Workflow Engine main functionalities can be implemented by creating C# objects which facilitates software integration. These objects are:

  • WorkflowRuntime - It provides an API for the Workflow Designer and enables process creation, document management, command execution, setting a process state and so on.
  • WorkflowDesigner - It should be created on the web site where the designer will be displayed.

Detailed information regarding how to integrate can be read here.

Workflow Engine main components

Workflow Engine was designed by considering the following main components:

  • Designer - The drag-and-drop and HTML5-driven process designer allows to create and modify schemes and it can be included in an application as ready-made library for React, Angular and JavaScript.

  • Backend library on .NET - The library leverages the software development process and it provides easily integration with .NET applications.

Workflow Engine process notation

Workflow Engine provides businesses with the capability of defining their internal processes by using its own graphical process notation which facilitates organizations the ability to automate and communicate their procedures but in a more flexible, simple and customized manner.

Workflow Server product based on Workflow Engine

Workflow Server is a product that contains the Workflow Engine and has additional functionality. It is possible to use the Workflow Server instead of embedding the Workflow Engine. It is a complete solution with an administration panel, APIs for process control, and the frontend; it can be integrated with NodeJS, PHP, Ruby, .NET, or Java applications through REST APIs. Moreover, there is available a Workflow Server Docker image which can be downloaded in this link.

Terms

Scheme and Process

A Process Scheme is a sequence of steps that your process follows. It describes:

  • Process states
  • Cross-state transitions
  • Commands for starting the transition process
  • Timers that start the transition process at a definite time or time intervals
  • Command access rules
  • Functions that are triggered when a process state is changed
  • C# or JavaScript code to check whether a user is authorized to run a command or change a process state
  • Process parameters description
  • Localization data

To give a few real-life examples, such a scheme can describe a document approval workflow, a process that runs some code at defined time intervals or a process whose actions are triggered by a command originating from an external system.

The scheme can be associated with software code that is subject to execution. If you open the Designer page, everything you see there is, essentially, a scheme.

A Process is a combination of saved parameters and a reference to the process scheme. The process knows its current state and parameters, if they have been set. This, for example, might be a business document approval process, or a process waiting for a command from an external system. One could think of a process as a program instance launched within a system, but it's not exactly like that.

Since Workflow Engine is designed for long-running transactions as well, it would be extremely wasteful to allocate resources to a process that isn't currently expected to perform any actions. That's why, when it's not affected by external commands or internal timers the process is in an idled state which is saved to your database. When triggered, the process loads and runs, then goes idle and stop consuming your app's resources. For each instance on the document page, there's a process that's activated by a command from the associated document form.

Main Scheme Elements

Main Scheme Elements

Activities and Transitions are the key elements of a process scheme.

Activities are process stages at which the engine stops and waits for a triggering event. Each Activity also contains Actions that should be performed as soon as the process moves to said Activity. Also, you can see State items in the scheme. Unlike Activity, which indicates the physical condition of the process, State depicts its business status. Activity is an obligatory item, while State is optional. Hereafter we will explain, how to use these items; in the meantime, please note that every Activity corresponds to a particular State.

A Transition connects two Activities and defines the process execution pattern. A Transition is run by a Trigger. There are three types of Trigger:

  • Automated — Transition will take place when the process enters the first Activity and executes Implementation completely.
  • Command-based — Transition is driven by an external command. You can manage command access rights for different users through the Actor object. You can read about the authorization process in further documentation.
  • Timer-based — the engine allows you to schedule process activities. You can read about timer management in further documentation.

When the trigger associated with the Transition is activated, the system validates its Condition. There are three types of Conditions:

  • Always - Condition is never checked and Transition always happens.
  • Condition - contains a link to a function which is called before a Transition happens. If it returns true, the Transition will happen; if it returns false, the process will remain in the former Activity.
  • Otherwise — Transition happens, unless the conditions of other Transitions have been met. If set together, the Condition and Otherwise types execute similarly to the operators if () then {} else {} in programming languages.

After the conditions get validated, the process passes to the next Activity, executing the Actions from the associated Implementation block. The process either stops and waits for an external trigger, or runs automatically triggered transitions if there are any.

Main Objects

Most of the time you'll be dealing with WorkflowRuntime. This object enables process creation, command list retrieval, command execution, setting a process state, etc. It also provides an API for the Workflow Designer. So, you'll have to create one WorkflowRuntime object in your application or service and call its methods to enable document management functionality.

You have to use persistence providers to connect to the process database. Depending on your database type, you have to create an object and pass it to WorkflowRuntime.

Example of integrating WorkflowRuntime into a web app:

Integrating Workflow Engine into a Web App

Example of integrating WorkflowRuntime into a service:

Integrating Workflow Engine into a Web Service

For a better understanding, download a sample that shows WorkflowRuntime integrated into an application, or use the source code from the WorkflowServer project — a clear example of WorkflowRuntime integration into a web service.

Further, articles provide a detailed step-by-step guide on how to create and configure WorkflowRuntime and Persistence Provider, and integrate a scheme designer into your app. If you are short on time, please proceed to the guide right away.