Wexflow - Open Source Workflow Engine - CodeProject
Wexflow - Open Source Workflow Engine - CodeProject
Akram El Assas
A high-performance, extensible, modular and cross-platform workflow engine. Built for automation.
Table of contents
1. Preface
2. What's New?
3. Introduction
4. Why Wexflow?
5. Real Life Examples
6. Benefits
7. How To Install Wexflow?
8. How To Uninstall Wexflow?
9. How To Use Wexflow?
1. General
2. Wexflow Manager
3. Backend
4. Android Manager
5. iOS Manager
6. Command Line Client
1. Sequential Workflows
2. Execution Graph
3. Flowchart Workflows
4. Approval Workflows
5. Workflow Events
Preface
The source code of Wexflow is on GitHub. I will be actively maintaining and adding brand new features to this project as I believe
very strongly in it. I will keep this article and the source code in sync.
You can download the latest stable release from GitHub releases page.
You can follow installation instructions whether in this article or in GitHub wiki.
To get started, you can follow usage instructions whether in this article or in GitHub wiki.
To start creating your own workflows, you can check out workflow samples whether in this article or in GitHub wiki. Also, check out
the 100+ built-in tasks that come with Wexflow.
You can contribute to this project in many ways. If you have brand new feature ideas or found a bug or faced an issue, just open a
new issue in the issue board. Pull requests are very welcome, to contribute follow these instructions to get the source code and
these guidelines to create pull requests.
What's New?
Take a look at the brand new version 4.8. This version includes an upgrade to .NET Core 3.0, bug fixes, performance enhancements
and under the hood updates.
This version has been depthly tested on Windows, Linux and macOS, and runs 100% on Windows, Linux and macOS.
Introduction
Wexflow is a high-performance, extensible, modular and cross-platform workflow engine. The goal of Wexflow is to automate
recurring tasks with or without user intervention. With the help of Wexflow, building automation and workflow processes become
easy. Wexflow also helps in making the long-running processes straightforward.
Wexflow aims to make automations, workflow processes, long-running processes and interactions between systems, applications
and folks easy, straightforward and clean. The communication between systems or applications becomes easy through this powerful
workflow engine.
Wexflow makes use of .NET Core, a cross-platform version of .NET for building websites, services, and console apps. Thus, Wexflow
provides a cross-platform workflow server and a cross-platform backend for managing, designing and tracking workflows with ease
and flexibility. Wexflow server and its backend run on Windows, Linux and macOS.
Wexflow also makes use of Quartz.NET open source job scheduling system that is used in large scale enterprise systems. Thus,
Wexflow offers flexibility in planning workflow jobs such as cron workflows.
Furthermore, Wexflow makes use of must popular databases such as CosmosDB, MongoDB, RavenDB and LiteDB serverless NoSQL
Document Store database in its server and back end which enhance and improve the performance of this workflow engine. The user
can choose between the database of his choice at the installation.
Wexflow comes with a back end too, so you can search and filter among all your workflows, have real-time statistics on your
workflows, manage your workflows with ease, design your workflows with ease, and track your workflows with ease:
Just to give you an idea of what Wexflow does, this is a screenshot from the "Designer" page. Using the "Designer" page, we get a
nice visual overview of the dependency graph of the workflow. Each node represents a task which has to be run:
Moreover, the "Designer" page allows to edit workflow files through its Web XML editor:
Why Wexflow?
Free and open source.
Easy to install and effortless configuration.
Straightforward and easy to use.
A cross-platform workflow server.
A cross-platform back end.
An Android app for managing workflows.
An iOS app for managing workflows.
Sequential workflows.
Flowchart workflows.
Approval workflows.
100+ built-in tasks.
User-driven.
Cron scheduling.
CosmosDB, MongoDB, RavenDB and LiteDB support.
Extensive logging and incident reporting.
Real-time stats.
RESTful API.
Extensible.
Benefits
Gain time by automating repetitive tasks.
Save money by avoiding re-work and corrections.
Reduce human error.
Become more efficient and effective in completing your tasks.
Become more productive in what you do.
Become consistent in what you do.
This section shows how to install the .NET version of Wexflow on a Windows system, and how to install the .NET Core version of
Wexflow on a Windows system, a Linux system or a macOS system.
Windows (.NET)
Wexflow can be installed on Windows 7, Windows Server 2008 or higher. Wexflow supports .NET Framework 4.6.1 or higher.
2. Install Wexflow:
3. Select a destination location:
4. Choose the components to install:
It is highly recommended to install workflow samples. Especially if new built-in tasks are released.
Username: admin
Password: wexflow2018
Wexflow makes use of must popular databases such as CosmosDB, MongoDB, RavenDB and LiteDB serverless NoSQL Document
Store database in its server and back end. The user can choose between the database of his choice at the installation. The default
database used is LiteDB since it needs zero configuration. However, if you want to use MongoDB, RavenDB or CosmosDB just read
the documentation of the database of your choice in order to configure it and make Wexflow use it.
To change the port of the .NET Core version, edit the file Wexflow.Server\appsettings.json and change the value of the setting
"WexflowServicePort". Then, change the port in the backend too by editing the configuration file Backend\js\settings.js.
Finally, you can open the backend by opening the web page Backend\index.html on a browser.
To open the backend, go to "Backend" folder and double-click on the file "index.html":
You can sign in with these credentials if you installed Wexflow for the first time:
Username: admin
Password: wexflow2018
You can then change the password from the back end.
Wexflow makes use of must popular databases such as CosmosDB, MongoDB, RavenDB and LiteDB serverless NoSQL Document
Store database in its server and back end. The user can choose between the database of his choice at the installation. The default
database used is LiteDB since it needs zero configuration. However, if you want to use MongoDB, RavenDB or CosmosDB just read
the documentation of the database of your choice in order to configure it and make Wexflow use it.
Linux
Wexflow supports .NET Core 3.0 or higher.
Finally, you can open the backend by opening the web page /opt/wexflow/Backend/index.html on a browser:
You can sign in with these credentials if you installed Wexflow for the first time:
Username: admin
Password: wexflow2018
You can then change the password from the back end.
If you want to use the image processing tasks, you must install these libraries:
Wexflow makes use of must popular databases such as CosmosDB, MongoDB, RavenDB and LiteDB serverless NoSQL Document
Store database in its server and back end. The user can choose between the database of his choice at the installation. The default
database used is LiteDB since it needs zero configuration. However, if you want to use MongoDB, RavenDB or CosmosDB just read
the documentation of the database of your choice in order to configure it and make Wexflow use it.
macOS
Wexflow supports .NET Core 3.0 or higher.
cd /Applications/wexflow/Wexflow.Server
dotnet Wexflow.Server.dll
Finally, you can open the backend by opening the web page /Applications/wexflow/Backend/index.html on a browser:
You can sign in with these credentials if you installed Wexflow for the first time:
Username: admin
Password: wexflow2018
You can then change the password from the back end.
Wexflow makes use of must popular databases such as CosmosDB, MongoDB, RavenDB and LiteDB serverless NoSQL Document
Store database in its server and back end. The user can choose between the database of his choice at the installation. The default
database used is LiteDB since it needs zero configuration. However, if you want to use MongoDB, RavenDB or CosmosDB just read
the documentation of the database of your choice in order to configure it and make Wexflow use it.
Android
After Wexflow server is installed, proceed as follows to install Wexflow Manager on an Android device:
1. Download wexflow.apk
2. Install wexflow.apk
3. Launch Wexflow application and open the application settings through the settings menu:
Ensure that Wexflow server is running and that the port 8000 is open in the firewall.
That's it, Wexflow application is ready for work. You can sign in with these credentials if you installed Wexflow for the first time:
Username: admin
Password: wexflow2018
iOS
After Wexflow server is installed, proceed as follows to install Wexflow Manager on an iOS device:
7. Open Cydia Impactor. You'll see your iOS device in the second drop down.
10. Cydia Impactor will automatically install wexflow.ipa on your iOS device:
11. Enable "Untrusted developer" for Wexflow app:
iOS 9+>Settings>General>Profiles
iOS 6-8>Settings>General>Device Management>Wexflow [Confirm]
12. Launch Wexflow application and open the application settings through the settings menu:
That's it, Wexflow application is ready for work. You can sign in with these credentials if you installed Wexflow for the first time:
Username: admin
Password: wexflow2018
Windows
To uninstall Wexflow, simply click on "Uninstall" menu from "Windows Start menu > Wexflow".
The log file C:\Program Files\Wexflow\Wexflow.log is also not deleted to keep track of the last operations done by
Wexflow. However, If you do not need the logs you can delete the log files.
Linux
To uninstall Wexflow from a Linux system, proceed as follows:
macOS
To uninstall Wexflow from a macOS system, simply delete wexflow from /Applications/ folder.
Android
To uninstall Wexflow from an Android device, simply open Settings>Applications>Wexflow then uninstall it.
iOS
Tap and hold the app icon until it starts to wiggle and an x appears at the upper left corner of the icon. Then, tap the x, then tap
Delete.
General
After installing Wexflow, the folders C:\Wexflow\ and C:\WexflowTesting\ are created.
The folder C:\Wexflow\ is the main configuration folder of Wexflow and contains the following elements:
Wexflow.xml which is the main configuration file of Wexflow server. Its path can be configured from C:\Program
Files\Wexflow\Wexflow.Server.exe.config for the .NET version and from Wexflow.Server\appsettings.json for the .NET Core
version.
Workflow.xsd which is the XML Schema Definition of a workflow.
Temp/ which is the temporary folder of Wexflow.
Database/ which contains the database of Wexflow workflow engine.
Tasks/ which is an optional folder that can contain the dlls of custom tasks.
GlobalVariables.xml which contains the global variables for workflows.
TasksNames.json which contains the names of the tasks. This configuration file is used by the designer.
TasksSettings.json which contains the settings of the tasks. This configuration file is used by the designer.
The logs are written in C:\Program Files\Wexflow\Wexflow.log. There is one log file per day. The old log files are saved in this
format Wexflow.logyyyyMMdd.
Windows: The folders C:\Wexflow-dotnet-core\ and C:\WexflowTesting\ are created. The path of the main configuration file
C:\Wexflow-dotnet-core\Wexflow.xml can be configured from Wexflow.Server\appsettings.json. The logs are written in
Wexflow.Server\Wexflow.log.
Linux: The folders /opt/wexflow/Wexflow/ and /opt/wexflow/WexflowTesting/ are created. The path of the main
configuration file /opt/wexflow/Wexflow/Wexflow.xml can be configured from
/opt/wexflow/Wexflow.Server/appsettings.json. The logs are written in /opt/wexflow/Wexflow.Server/Wexflow.log.
macOS: The folders /Applications/wexflow/Wexflow/ and /Applications/wexflow/WexflowTesting/ are created. The path of
the main configuration file /Applications/wexflow/Wexflow/Wexflow.xml can be configured from
/Applications/wexflow/Wexflow.Server/appsettings.json. The logs are written
in /Applications/wexflow/Wexflow.Server/Wexflow.log.
Workflows can be designed through the designer or through XML editing by editing the configuration file of the workflow.
However, it is highly recommended to understand Wexflow workflow syntax in order to become familiar with this workflow engine.
<!--
This is the configuration file of a workflow.
A workflow is composed of:
- An id which is an integer that must be unique.
- A name which is a string that must be unique.
- A description which is a string.
- A Settings section which is composed of the following elements:
- A launchType which is one of the following options:
- startup: The workflow is launched when Wexflow Engine starts.
- trigger: The workflow is launched manually from Wexflow Manager.
- periodic: The workflow is launched periodically.
- cron: The workflow is launched depending on a cron expression.
- A period which is necessary for the periodic launchType. It is
a timeSpan in this format dd.hh:mm:ss. For example the period
00.00:02:00 will launch the workflow every 2 minutes.
- A cron expression which is necessary for the cron launchType.
For example '0 0/2 * * * ?' will launch the workflow every 2 minutes.
- The enabled option which allows to enable or disable a workflow.
The possible values are true or false.
- The approval option which marks the current workflow as an approval workflow.
The possible values are true or false. An approval workflow must contain
at least one Approval task or more.
- A LocalVariables section which contains local variables.
- A Tasks section which contains the tasks that will be executed by
the workflow one after the other.
- A Task is composed of:
- An id which is an integer that must be unique.
- A name which is one of the options described in the tasks documentation.
- A description which is a string.
- The enabled option which allows to enable or disable a task. The possible
values are true or false.
- A collection of settings.
- An ExecutionGraph section which contains the execution graph of the workflow.
-->
<Workflow xmlns="urn:wexflow-schema" id="$int" name="$string" description="$string">
<Settings>
<Setting name="launchType" value="startup|trigger|periodic|cron" />
<Setting name="period" value="dd.hh:mm:ss" />
<Setting name="cronExpression" value="$string" />
<Setting name="enabled" value="true|false" />
<Setting name="approval" value="true|false" />
</Settings>
<LocalVariables>
<Variable name="$string" value="$string" />
<Variable name="$string" value="$string" />
<!-- You can add as many variables as you want. -->
</LocalVariables>
<Tasks>
<Task id="$int" name="$string" description="$string" enabled="true|false">
<Setting name="$string" value="$string" />
<Setting name="$string" value="$string" />
<!-- You can add as many settings as you want. -->
</Task>
<Task id="$int" name="$string" description="$string" enabled="true|false">
<Setting name="$string" value="$string" />
<Setting name="$string" value="$string" />
</Task>
<!-- You can add as many tasks as you want. -->
</Tasks>
<!-- This section is optional and described in the samples section. -->
<ExecutionGraph />
</Workflow>
To learn how to make your own workflows, you can check out the workflow samples availabe in the designer page, in the samples
section, and read the tasks documentation.
If a new workflow is created or if an existing workflow is deleted or modified, you don't have to restart Wexflow Windows Service so
that these modifications take effect. Wexflow engine will automatically detect the changes and reload, add or delete the workflow.
To disable a workflow, you can set the enabled settings option of the workflow to false.
State is transferred between tasks through selectFiles and through selectEntities settings.
1. A task in a workflow does its job and produces files which it stores in a collection.
2. Another task (must be in the same workflow) can afterwards reference those files with the selectFiles XML property,
specifying the ID of the task that produced the required files. It then can use these files to do its own job.
selectEntities setting works the same way as selectFiles. The only difference is that selectEntities is designed to be used for tasks that
manipulate custom objects from a database or from web services for example. To go further, read this documentation regarding
entities.
Wexflow Manager
When you open Wexflow Manager for the first time, you will get this window:
Here are the credentials to sign in:
Username: admin
Password: wexflow2018
With Wexflow Manager, you can manage your workflows with ease. Wexflow Manager is a simple application that allows the user to
do the following things:
To see what's going on in Wexflow, open the log file C:\Program Files\Wexflow\Wexflow.log in a text editor like
Notepad++. Notepad++ will update the log file as it fills up.
Backend
The backend is a website that can be hosted on IIS, Apache, Nginx or any other web server. The backend can also run locally.
The backend gives real-time statistics on workflows. It will let you manage, design and track your workflows with ease and flexibility.
You can use the backend to access, configure, manage, administer, and develop your workflows with ease.
Login
When you open the backend for the first time, you will arrive on the login page:
Username: admin
Password: wexflow2018
After you sign in, you can change the password from the "Users" page.
Password reset
If a user forgot his password, he can click on "Forgot password?" link to reset his password:
When the user clicks on "Submit" button, an email is sent to him with a temporary password that he can change after he signs in.
To allow the backend sending emails, the SMPT configuration must be set in the configuration file: C:\Program
Files\Wexflow\Wexflow.Server.exe.config:
In the .NET Core version, the configuration file to edit in a Windows system is Wexflow.Server\appsettings.json:
{
"WexflowSettingsFile": "C:\\Wexflow-dotnet-core\\Wexflow.xml",
"WexflowServicePort": 8000,
"DateTimeFormat": "dd-MM-yyyy HH:mm:ss",
"Smtp.Host": "smtp.gmail.com",
"Smtp.Port": 587,
"Smtp.EnableSsl": true,
"Smtp.User": "user",
"Smtp.Password": "password",
"Smtp.From": "user",
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
}
}
{
"WexflowSettingsFile": "/opt/wexflow/Wexflow/Wexflow.xml",
"WexflowServicePort": 8000,
"DateTimeFormat": "dd-MM-yyyy HH:mm:ss",
"Smtp.Host": "smtp.gmail.com",
"Smtp.Port": 587,
"Smtp.EnableSsl": true,
"Smtp.User": "user",
"Smtp.Password": "password",
"Smtp.From": "user",
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
}
}
{
"WexflowSettingsFile": "/Applications/wexflow/Wexflow/Wexflow.xml",
"WexflowServicePort": 8000,
"DateTimeFormat": "dd-MM-yyyy HH:mm:ss",
"Smtp.Host": "smtp.gmail.com",
"Smtp.Port": 587,
"Smtp.EnableSsl": true,
"Smtp.User": "user",
"Smtp.Password": "password",
"Smtp.From": "user",
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
}
}
Dashboard
After you sign in, you will arrive on the dashboard page:
Wexflow gives you a beautiful dashboard to view real-time statistics on your workflows. Indeed, the "Dashboard" page gives you
real-time statistics on workflows and will let you track your workflow server with ease and detail. From the dashboard, you can also
filter the workflow entries by a keyword or by date. You can also order the workflow entries by date, by name, etc.
Manager
The "Manager" page will let you manage your workflows with ease. Indeed, from this page you can start a workflow, suspend a
running workflow, resume a suspended workflow, stop a running workflow and search for workflows by a keyword:
Designer
The "Designer" page will let you design your workflows with ease. Indeed, from this page you can create a new workflow, edit an
existing workflow or delete a workflow. This page will also let you visualize the dependency graph of a workflow. Using the
"Designer" page, we get a nice visual overview of the dependency graph of the workflow. Each node represents a task which has to
be run:
Furthermore, the "Designer" page allows to edit workflow files through its Web XML editor:
Approval
The "Approval" page will let you view all approval workflows and will let you approve or disapprove workflows that need approval:
History
The "History" page will let you track all your workflows and everything that happens on the workflow server. Indeed, from this page
you will have an overview of all the workflow instances executed on the workflow server. Furthermore, you can filter the entries by
keywords or date. You can also order the entries by date, by name, etc.
Users
The "Users" page allows to create new users, change passwords and user's informations, and delete users who have restricted
access.
A user who has restricted rights has only access to the "Dashboard" page and the "History" page. When he signs in, he'll have the
following view of the backend:
Profiles
The "Profiles" page allows to assign workflows to users. Once the workflow assigned, the user can run it, modify it and delete it.
Installation
The backend is a website that can be hosted on IIS, Apache, Nginx or any other web server. The backend can also run locally.
To install the backend on a web server, simply copy the content of the folder "C:\Program Files\Wexflow\Backend" in the web server.
Then, configure the workflow server URI if you want to install the backend on another machine. Simply edit the configuration file
"js/settings.js":
Settings = {
Uri: "http://localhost:8000/wexflow/"
};
Instead of localhost, put the IP or the DNS of the machine where Wexflow server is installed.
Android Manager
Wexflow provides an Android application for managing workflows.
iOS Manager
Wexflow provides an iOS application for managing workflows.
Options
Examples
The following command starts the workflow 41 and waits until it finishes its jobs:
Wexflow.Clients.CommandLine.exe -o start -i 41 -w
Wexflow.Clients.CommandLine.exe -o start -i 41
Stop
Wexflow.Clients.CommandLine.exe -o stop -i 41
Suspend
Wexflow.Clients.CommandLine.exe -o suspend -i 41
Resume
Wexflow.Clients.CommandLine.exe -o resume -i 41
Approve
Disapprove
Windows (.NET)
The command line tool is located in C:\Program Files\Wexflow\Wexflow.Clients.CommandLine. To run the command line tool, just
run the executable C:\Program Files\Wexflow\Wexflow.Clients.CommandLine\Wexflow.Clients.CommandLine.exe
The command line tool is located in .\Wexflow.Clients.CommandLine. To run the command line tool, just run the following
command
cd .\Wexflow.Clients.CommandLine
dotnet Wexflow.Clients.CommandLine.dll
Linux
After installing Wexflow on Linux, the command line tool is located in /opt/wexflow/Wexflow.Clients.CommandLine. To run the
command line tool, just run the following command
cd /opt/wexflow/Wexflow.Clients.CommandLine
dotnet Wexflow.Clients.CommandLine.dll
macOS
After installing Wexflow on macOS, the command line tool is located in /Applications/wexflow/Wexflow.Clients.CommandLine. To
run the command line tool, just run the following command
cd /Applications/wexflow/Wexflow.Clients.CommandLine
dotnet Wexflow.Clients.CommandLine.dll
Workflow Samples
Wexflow is designed in a way to make things easy and straightforward for beginners in the world of workflows and automation.
Workflows can be designed through the designer or through XML editing by editing the configuration file of the workflow.
However, it is highly recommended to understand Wexflow workflow syntax in order to become familiar with this workflow engine.
Each configuration file contains a set of settings and tasks to do depending on a specified schedule and a specified configuration.
In this section, few workflow samples will be presented in order to make the end user familiar with Wexflow workflows syntax:
1. Sequential Workflows
2. Execution Graph
3. Flowchart Workflows
4. Approval Workflows
5. Workflow Events
Sequential Workflows
A sequential workflow executes a set of tasks in order, one by one. Tasks are executed in a sequential manner until the last task
finishes. The order of the execution of the tasks can be altered by modifying the execution graph of the workflow.
Workflow 1
This workflow uploads invoices to an SFTP server, then waits for 2 days and then notifies the customers.
First of all, the FilesLoader task loads all the invoices located in the folder C:\WexflowTesting\Invoices\, then the
Ftp task uploads them to the SFTP server, then the Wait task waits for 2 days, then the FilesLoader task loads the emails in
XML format and then the MailsSender task sends the emails. Finally, the FilesMover task moves the invoices to the
folder C:\WexflowTesting\Invoices_sent\.
Workflow 2
First of all, the FilesLoader task loads all the files located in the folders C:\WexflowTesting\Watchfolder1\
and C:\WexflowTesting\Watchfolder2\ then the Ftp task loads the files and uploads them to the FTP server. Finally,
the FilesMover task moves the files to the folder C:\WexflowTesting\Sent\.
Workflow 3
This workflow transcodes the WAV files located in C:\WexflowTesting\WAV\ to MP3 format through FFMPEG and moves
the transcoded files to C:\WexflowTesting\MP3\.
First of all, the FilesLoader task loads all the files located in the folder C:\WexflowTesting\WAV\ then
the ProcessLauncher task launches FFMPEG process on every file by specifying the right command in order to create the MP3
file. Finally, the FilesMover task moves the MP3 files to the folder C:\WexflowTesting\MP3\.
Workflow 4
This workflow waits for WAV files to arrive in C:\WexflowTesting\WAV\ then transcodes them to MP3 files through VLC
then uploads the MP3 files to an FTP server then moves the WAV files to C:\WexflowTesting\WAV_processed\. This
workflow starts every 2 minutes.
First of all, the FilesLoader task loads all the files located in the folder C:\WexflowTesting\WAV\ then
the ProcessLauncher task launches VLC process on every file by specifying the right command in order to create the MP3 file.
Then, the Ftp task loads the MP3 files generated by the ProcessLauncher task and then uploads them to the FTP server.
Finally, the FilesMover task moves the processed WAV files to the folder C:\WexflowTesting\WAV_processed\.
Workflow 5
This workflow downloads specific files from an FTP server. This workflow starts by listing all the files located at the root folder of the
server, then the specific files that will be downloaded are tagged through an XSLT (LisFiles.xslt), then the files
are downloaded by the Ftp task through todo="toDownload" and from="app4" tags, then the downloaded files
are moved to the folder C:\WexflowTesting\Ftp_download\.
Roughly speaking, the Ftp task loads the list of files located at the root folder of the FTP server in the running instance of the
workflow, then the ListFiles task outputs and XML file that contains all the files loaded then the Xslt task takes as input this
XML and generates an XML which contains a system node called <WexflowProcessing> which contains the list of files to be
tagged and/or renamed.
To understand how tagging and renaming files work, refer to the documentation of the ListFiles and Xslt tasks.
<xsl:template match="/">
<root>
<WexflowProcessing>
<xsl:for-each select="//WexflowProcessing/Workflow/Files//File">
<xsl:choose>
<xsl:when test="@name = 'file1.txt'">
<File taskId="{@taskId}" name="{@name}" renameTo="file1_renamed.txt"
todo="toRename" from="app1" />
</xsl:when>
<xsl:when test="@name = 'file2.txt'">
<File taskId="{@taskId}" name="{@name}" renameTo="file2_renamed.txt"
todo="toSend" from="app2" />
</xsl:when>
<xsl:when test="@name = 'file3.txt'">
<File taskId="{@taskId}" name="{@name}" renameTo="file3_renamed.txt"
todo="toDownload" from="app3" />
</xsl:when>
<xsl:when test="@name = 'file4.txt'">
<File taskId="{@taskId}" name="{@name}" renameTo="file4_renamed.txt"
todo="toDownload" from="app4" />
</xsl:when>
</xsl:choose>
</xsl:for-each>
</WexflowProcessing>
</root>
</xsl:template>
</xsl:stylesheet>
Execution Graph
First of all, the FilesLoader task loads the file C:\WexflowTesting\file1.txt then the Ftp task loads that file and
uploads it to the FTP server. Finally, the FilesMover task moves that file to the folder C:\WexflowTesting\Sent\.
By convention, the parent task id of the first task to be executed must always be -1. The execution graph of this workflow will
execute the tasks in the following order:
<ExecutionGraph>
<Task id="1"><Parent id="-1" /></Task>
<Task id="3"><Parent id="1" /></Task>
<Task id="2"><Parent id="3" /></Task>
</ExecutionGraph>
<ExecutionGraph>
<Task id="3"><Parent id="-1" /></Task>
<Task id="2"><Parent id="3" /></Task>
<Task id="1"><Parent id="2" /></Task>
</ExecutionGraph>
1. Infinite loops.
2. Parallel tasks.
<ExecutionGraph>
<Task id="1"><Parent id="-1" /></Task>
<Task id="2"><Parent id="1" /></Task>
<Task id="1"><Parent id="2" /></Task>
</ExecutionGraph>
<ExecutionGraph>
<Task id="1"><Parent id="-1" /></Task>
<Task id="2"><Parent id="1" /></Task>
<Task id="3"><Parent id="1" /></Task>
</ExecutionGraph>
Flowchart Workflows
A flowchart workflow is a workflow that contains at least one flowchart node (If/While/Switch) in its execution graph. A flowchart
node takes as input a flowchart task and a set of tasks to execute in order, one by one. The order of the execution of the tasks can
be altered by modifying the execution graph of the flowchart node.
If
The following workflow is a flowchart workflow that is triggered by the file file.trigger. If the file file.trigger is found on the file
system then this workflow will upload the file file1.txt to an FTP server then it will notify customers that the upload was successful.
Otherwise, if the trigger file.trigger is not found on the file system then the workflow will notify customers that the upload failed.
By convention, the parent task id of the first task to execute in <Do> and <Else> nodes must always be -1.
You can add If flowchart nodes pretty much wherever you want in the execution graph. Also, you can add as mush as you want.
You can also add them in the event nodes OnSuccess, OnWarning and OnError.
While
This workflow is triggered by the file file.trigger. While the file file.trigger exists, this workflow will upload the file file1.txt to an FTP
server then it will notify customers then it will wait for 2 days then it will start again.
By convention, the parent task id of the first task to be executed in the <While> node must always be -1.
You can add While flowchart nodes pretty much wherever you want in the execution graph. Also, you can add as mush as you
want. You can also add them in the event nodes OnSuccess, OnWarning and OnError.
Switch
This workflow starts every 24 hours. On Monday, it uploads files to an FTP server and on Wednesday it notifies customers.
By convention, the parent task id of the first task to be executed in the Case/Default nodes must always be -1.
You can add Switch flowchart nodes pretty much wherever you want in the execution graph. Also, you can add as mush as you
want. You can also add them in the event nodes OnSuccess, OnWarning and OnError.
Approval workflows
Approval workflows are workflows marked as approval through approval setting option. They can be marked as approval whether
from the Designer page in the back end or by XML editing:
Workflows are being approved whether from Wexflow Manager or from Approval page in the back end or from Wexflow Android
Manager or from Wexflow iOS Manager.
If the workflow is disapproved the OnDisapproved workflow event is raised and the tasks after Approval task are not executed.
The disapproval of workflows can be done by clicking on disapprove button whether from Approval page in the back end or from
Wexflow Manager or from Wexflow Android Manager or from Wexflow iOS Manager.
To give you a hint on how approval workflows work, here is a very simple example:
This simple workflow is an approval workflow that waits for approval in order to start. Once approved, this workflow waits for 2
seconds. This workflow can be approved or disapproved whether from Wexflow Manager or from Approval page in the back end or
from Wexflow Android Manager or from Wexflow iOS Manager.
This simple workflow is an approval workflow that waits for approval in order to start. Once approved, this workflow waits for 2
seconds. If this workflow is disapproved, the task 2 is not executed and the task 3 is executed. In other words, if this workflow is
disapproved it waits for 3 seconds. This workflow can be approved or disapproved whether from Wexflow Manager or
from Approval page in the back end or from Wexflow Android Manager or from Wexflow iOS Manager.
This workflow starts by uploading videos to YouTube then it waits for approval in order to check that videos have been effectively
uploaded with success to YouTube and edited by the management team. Then, if this workflow is approved from Approval page in
the back end or from Wexflow Manager or from Wexflow Android Manager or from Wexflow iOS Manager a notification mail is
being sent in order to notify the management team that YouTube videos have been effectively uploaded with success to YouTube.
When this workflow arrives to Approval task, it suspends its jobs and waits for approval process until it's being approved and then
continues its tasks.
Form submission approval workflow
This approval workflow opens a submission form and waits for approval. If the submission is correct, the workflow is approved and
waits for 2 seconds (this is just a simple task for testing but you can add email tasks or whatever). Otherwise, if the submission is
incorrect, the workflow is disapproved and waits for 3 seconds (this is just a simple task for testing but you can add email tasks or
whatever). This workflow works on the .NET Core version of Wexflow only because the .NET version of Wexflow does not support
opening GUI from ProcessLauncher task since Wexflow server is running in a Windows service in the .NET version.
Approval workflows are very useful when some tasks get done then you have to wait for approval to check that previous tasks have
been done with success then users are notified for example. This is just an example, but you can create and imagine other examples
as you want and as you need.
Workflow Events
After a workflow finishes its job, its final result is either success, or warning or error. If its final result is success, the OnSuccess event
is triggered. If its final result is warning, the OnWarning event is triggered. If its final result is error, the OnError event is triggered. An
event contains a set of tasks and/or flowchart nodes to execute in order, one by one. The order of the execution of the tasks and/or
flowchart nodes can be altered by modifying the execution graph of the event.
This workflow uploads the file1.txt to an FTP server then notifies customers in case of success.
The flowchart event nodes OnWarning, OnError and OnDisapproved can be used in the same way. You can put If and
While flowchart nodes in event nodes.
For OnDisapproved workflow event, the workflow must be an approval workflow and must contain at least one Approval task.
The OnDisapproved workflow event is raised once the end user clicks on disapprove button whether from the Approval page in
the back end or from Wexflow Manager or from Wexflow Android Manager or from Wexflow iOS Manager.
These are simple and basic workflows to give an idea on how to make your own workflows. However, if you have multiple
systems, applications and automations involved in a workflow, the workflow could be very interesting.
General
Custom tasks are a must in a workflow engine and allow systems and applications to interact.
To create a custom task MyTask for example you will need to proceed as follows:
3. Create a public class MyTask that implements the abstract class Wexflow.Core.Task.
using System.Threading;
using System.Xml.Linq;
using Wexflow.Core;
namespace Wexflow.Tasks.MyTask
{
public class MyTask : Task
{
public MyTask(XElement xe, Workflow wf) : base(xe, wf)
{
// Task settings goes here
}
Each task returns a TaskStatus object when it finishes performing its job. TaskStatus is composed of the following
elements:
For example, if a task performs an opetation on a collection of files and if this operation succeeds for all the files then its Status
should be Success. Otherwise if this operation succeeds for some files and fails for others then its Status should be
Warning. Otherwise if this operation fails for all the files then its Status should be Error.
The Condition property is designed for flowchart tasks. In addition to the Status of the task, a flowchart task returns either
true or false after performing its operation.
The Condition property should always be set to false for sequential tasks.
The SwitchValue is designed to be used by Switch flowchart nodes. If you set a value in the SwitchValue property and
use this task in a Switch flowchart node, the case corresponding to the value will be executed. Otherwise, if the Default case is
set, it will be executed.
You can use the TaskStatus constructor that suits your needs.
To select the files loaded by the running instance of a workflow through the selectFiles settings option, you can do it as
follows:
To select entities loaded by the running instance of a workflow through the selectEntities settings option, you can do it as
follows:
The Entity class could be very useful when working with custom tasks that manipulate objects from a database or Web Services
for example.
this.Entities.Add(myEntity);
Finally if you finished coding your custom task, compile the class library project and copy the assembly Wexflow.Tasks.MyTask.dll
in C:\Program Files\Wexflow\ or in C:\Wexflow\Tasks\. The path of the folder C:\Wexflow\Tasks\ can be configured
through tasksFolder setting in the configuration file C:\Wexflow\Wexflow.xml.
That's it. That's all the things you need to know to start coding your own custom tasks.
To test the custom task, create a new workflow (new XML file) and put the configuration of the custom task in it as follows:
The workflow will then appear in the list of workflows in Wexflow Manager. You can then launch it from there.
Logging
The following methods are available from the Task class for logging:
Files
this.Files.Add(myFile);
this.Files.AddRange(myFiles);
Then the files loaded can be selected in other tasks by their task Id as follows:
To select the files loaded by the running instance of a workflow through the selectFiles settings option, you can do it as follows:
Entities
Entity is an abstract class having the Id of the task as property:
namespace Wexflow.Core
{
public abstract class Entity
{
public int TaskId { get; set; }
}
}
The entity class is designed to be inherited by other classes such as objects retrieved from a database or a web service or an API or
whatever. Then, these objects can be loaded in a task by calling the methods Add or AddRange:
this.Entities.Add(myEntity);
this.Entities.AddRange(myEntities);
Then, the entities loaded can be selected in other tasks by their task Id as follows:
To select entities loaded by the running instance of a workflow through the selectEntities settings option, you can do it as follows:
The Entity class could be very useful when working with custom tasks that manipulate objects from a database or Web Services for
example.
Shared Memory
Tasks contains a Hashtable that can be used as a shared memory between them.
this.Hashtable.Add("myKey", myObject);
this.Hashtable.Remove("myKey");
Designer
To make your custom task MyTask appear in the dropdown of the designer, simply open the file C:\Wexflow\TasksNames.json and
add "MyTask" in it as follows:
[
...
"MyTask"
]
You must also add the settings by opening the file C:\Wexflow\TasksSettings.json and adding your custom settings as follows:
{
...
"MyTask": ["settingName"]
}
That's it. MyTask will show up in the designer dropdowns and when selected its settings will show up too.
Debugging
To debug custom tasks, you can use logging.
You can also clone this Wexflow's repository and open Wexflow.sln in Visual Studio 2019 and follow these guidelines to debug
Wexflow server. Then, you can create your custom task in the solution and debug it. Of course, to debug it you have to proceed as
follows:
That's it. I hope you enjoyed reading this article. If you have any thoughts to improve Wexflow or if you face any issues or if you
want to contribute to this project please let me know in the comments or in GitHub.
FluentFTP: An FTP client supporting FTP and FTPS(exmplicit/implicit) written in C# and under MIT license.
SSH.NET: An SSH library for .NET written in C# and under MIT license.
SharpZipLib: A Zip, GZip, Tar and BZip2 library written in C# and under MIT license.
Saxon-HE: An XSLT and XQuery Processor that provides implementations of XSLT (2.0), XQuery (1.0, 3.0, and 3.1), and XPath
(2.0, 3.0, and 3.1) at the basic level of conformance defined by W3C. It's an open source library available under the Mozilla
Public License version 1.0.
log4net: A port of the famous Apache log4j framework to the Microsoft .NET runtime. It's under the Apache license version
2.0.
TweetSharp: A fast and clean wrapper around the Twitter AP written in C#.
Microsoft Sync Framework 2.1: A data synchronization platform that allows to synchronize data across multiple data stores.
Json.NET: A high-performance JSON framework for .NET written in C# and under MIT license.
Hammock: an HTTP library that simplifies consuming and wrapping RESTful services.
Mono.Security: A library that provides the missing pieces to .NET security.
Oracle Data Access Components (ODAC): Oracle database client for .NET.
MySQL Connector/Net: A fully-managed ADO.NET driver for MySQL.
System.Data.SQLite: An ADO.NET provider for SQLite.
Npgsql: An open source ADO.NET Data Provider for PostgreSQL written in C# and under the PostgreSQL License, a liberal
OSI-approved open source license.
.NET Data Provider for Teradata: An ADO.NET provider for Teradata.
Eto.Forms: A cross platform GUI framework for desktop and mobile applications in .NET.
highlight.js: Javascript syntax highlighter.
Cytoscape.js: Graph theory / network library for analysis and visualization.
OpenPop.NET: An open source implementation of a POP3 client and a robust MIME parser written in C#. It allows developers
easy access to email on a POP3 server in a matter of minutes.
iTextSharp: .NET port of the iText library.
DiffPlex: A Netstandard 1.0 C# library to generate textual diffs.
MonoTorrent: A cross-platform library implementing the BitTorrent protocol. It is based on the Mono implementation of the
.NET Framework.
Quartz.NET: A port of Java Quartz which is an enterprise class job sheduling system.
SharpCompress: A fully managed C# library to deal with many compression types and formats.
DiscUtils: Utility libraries to interact with discs, filesystem formats and more.
SevenZipSharp: Managed 7-zip library written in C# that provides data (self-)extraction and compression (all 7-zip formats
are supported). It wraps 7z.dll or any compatible one and makes use of LZMA SDK.
7-Zip: 7-Zip is a file archiver with a high compression ratio.
Selenium WebDriver: A set of different software tools each with a different approach to supporting browser automation.
ChromeDriver: An open source tool for automated testing of webapps across many browsers.
NUglify: A HTML, JavaScript and CSS minification Library for .NET.
SharpScss: A portable cross-platform pinvoke .NET wrapper around libsass to convert SCSS to CSS.
libsass: A C/C++ implementation of a Sass compiler.
YamlDotNet: A .NET library for YAML.
LiteDB: A .NET NoSQL Document Store in a single data file.
Nancy: Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono.
Kestrel: A cross platform web server for ASP.NET Core.
YouTube Dat API: Allows to add YouTube features to an application, including the ability to upload videos, create and
manage playlists, and more.
Tweetinvi: an intuitive Twitter C# library for the REST and Stream API. It supports .NET, .NETCore, UAP and Portable Class
Libraries (Xamarin).
InstagramApiSharp: A complete Private Instagram API for .NET (C#, VB.NET).
Ace: An embeddable code editor written in JavaScript.
Reddit.NET: A Reddit API library for .NET Standard with OAuth support. Written in C#.
Vimeo API: Vimeo's API supports flexible, high-quality video integration with custom apps.
SlackAPI: .NET Implementation of the Slack team communication platform API.
MongoDB.Driver: MongoDB driver.
RavenDB.Client: RavenDB driver.
Microsoft.Azure.DocumentDB: CosmosDB driver.
commandline: The best C# command line parser that brings standardized *nix getopt style, for .NET.
History
05 Jan 2017:
09 Jan 2017:
16 Jan 2017:
23 Jan 2017:
26 Jan 2017:
30 Jan 2017:
06 Feb 2017:
17 Feb 2017:
06 Mar 2017:
07 Apr 2017:
Released version 1.0.9.
Fixed Switch flowchart node children execution.
Fixed WCF service configuration issue.
22 May 2017:
07 Oct 2017:
If a workflow XML file is added to Workflows folder, It is automatically loaded without having to restart
Wexflow Windows service.
If a workflow XML file is deleted from Workflows folder, It is automatically stopped and removed without
having to restart Wexflow Windows service.
If a workflow XML file is changed. It is automatically reloaded without having to restart Wexflow Windows
service.
11 Oct 2017:
13 Oct 2017:
15 Oct 2017:
16 Oct 2017:
17 Oct 2017:
18 Oct 2017:
19 Oct 2017:
20 Oct 2017:
27 Oct 2017:
Sha1: This task generates SHA-1 hashes of a collection of files and writes the results in an XML file.
Sha256: This task generates SHA-256 hashes of a collection of files and writes the results in an XML file.
Sha512: This task generates SHA-512 hashes of a collection of files and writes the results in an XML file.
FilesConcat: This task concatenates a collection of files.
FilesSplitter: This task splits files into chunks.
FilesInfo: This task generates files information of a collection of files and writes the results in an XML file.
MediaInfo: This task generates the most relevant technical and tag data for video and audio files and outputs
the results in an XML file.
MailsReceiver: This task fetches a collection of emails.
ProcessKiller: This task kills a process.
05 Nov 2017:
14 Nov 2017:
Moved tasks names and tasks settings to external files (C:\Wexflow\TasksNames.json and
C:\Wexflow\TasksSettings.json).
Added Xml and Documentation buttons for tasks.
12 Oct 2018:
Zip task: Now, if the zip file name is left blanked, the RenameToOrName of the first file in the collection will be
taken as the zip file name. For example if the RenameToOrName of the first file is file1.txt, the zip file name will be
file1.zip.
18 Oct 2018:
Cc is now optional.
Added Bcc. It is also optional.
20 Oct 2018:
23 Oct 2018:
29 Oct 2018:
04 Nov 2018:
07 Nov 2018:
09 Nov 2018:
12 Nov 2018:
16 Nov 2018:
Fixed an issue regarding entries and history entries in the back office.
Fixed an issue in the tasks ImagesConcat and ImagesOverlay.
Fixed an issue in the tasks Sha256 and Sha512.
Fixed a validation issue in the designer.
Updated the Template task.
Updated Wexflow Web Manager.
19 Nov 2018:
23 Nov 2018:
28 Nov 2018:
03 Dec 2018:
10 Dec 2018:
14 Jul 2019:
29 Jul 2019:
01 Aug 2019:
05 Aug 2019:
13 Aug 2019:
Added a setting option in SqlToCsv task to not generate the file if the result set is empty.
Updated Android app.
Updated nuget package to version 4.3.0.
Fixed date and time issues in the backend.
Fixed file locks issues.
Fixed FileSystemWatcher issues.
Fixed an issue when deleting a workflow from the designer in the .NET Core version.
Upgraded to FluentFTP 27.0.2.
Upgraded to ServiceStack.Kestrel 5.6.0.
Upgraded to Newtonsoft.Json 12.0.2.
Upgraded to Google.APis.YouTube.v3 1.40.3.1663.
Updated the documentation.
23 Aug 2019:
This brand new version is a major and stable release that includes brand new features, bug fixes, major performance
enhancements and under the hood updates.
Brand new features, bug fixes, major performance enhancements and under the hood updates.
Added approval workflows.
Added OnDisapproved workflow event.
Added form submission processes.
Added approval status and buttons to Android app.
Added search feature (CTRL+F) in XML Web editor.
Added replace feature (CTRL+H) in XML Web editor.
Added go to line feature (CTRL+L) in XML Web editor.
Added settings menu feature (CTRL+,) in XML Web editor.
Added keyboard shortcuts feature (CTRL+ALT+H) in XML Web editor.
Added 34+ themes in XML Web editor.
Added an option in the installers to whether install workflow samples or not.
Added maxRetries and retryTimeout setting options.
Added the new following tasks:
07 Sep 2019:
16 Sep 2019:
21 Sep 2019:
25 Sep 2019:
License
This article, along with any associated source code and files, is licensed under The MIT License
Akram El Assas graduated from the french engineering school ENSEIRB located in Bordeaux, a city in the south of France, and got
his diploma in software engineering in 2010. He worked in France for Mediatvcom, a company specialized in audiovisual, digital
television and new technologies. Mediatvcom offers services such as consulting, project management, audit and turnkey
solutions adapted to the needs of customers. Akram worked mainly with Microsoft technologies such as C#, ASP.NET and SQL
Server but also with JavaScript, jQuery, HTML5 and CSS3. Akram worked on different projects around digital medias such as
Media Asset Management systems, Digital Asset Management systems and sometimes on HbbTV apps.
GitHub profile
Follow on Twitter
Website