工作流引擎是什么?开源工作流引擎

Oden 769 2022-07-02

工作流引擎是什么?

工作流引擎,软件开发中不可避免的重要一环。

所谓工作流引擎,是指workflow作为应用系统的一部分,并为之提供对各应用系统有决定作用的根据角色、分工和条件的不同决定信息传递路由、内容等级等核心解决方案。

工作流引擎包括流程的节点管理、流向管理、流程样例管理等重要功能。

什么是工作流引擎

开发一个优秀的软件系统,系统界面是最基础的部分,数据库之间的信息交换是必备条件,而根据业务需求开发出符合实际的程序逻辑,并在一定程度上保证其稳定性、易维护性才是根本。稳定性自不必说,易维护性则要保证模块化和结构化,这样可以在业务流程发生变化,例如决策权的改变、组织结构的变动时产生的全新业务逻辑,而工作流引擎解决的就是这个问题。如果应用程序缺乏强大的逻辑层,就会变得容易出错,比如信息的路由错误、死循环等等。

举个简单的例子,一辆汽车,外观很漂亮,但是如果发动机有问题,那就变成了一个摆设,势必会bug不断。而应用系统的拓展性就好比汽车的引擎转速,别人的百公里加速只要10s,而你的则需要一个小时(业务流程变动需要更长时间的程序修改),孰优孰劣,一目了然。而如果引擎再动不动就熄火(程序逻辑死循环),那这样的车谁还会叫好呢?

服务架构

面向服务的体系结构,是一个组件模型,它将应用程序的不同功能单元通过这些服务之间定义良好的接口和契约联系起来。接口是采用中立的方式进行定义的,它应该独立于实现服务的硬件平台、操作系统和编程语言。工作流引擎使得构建在各种这样的系统中的服务,可以以一种统一和通用的方式进行交互。


案例

以前一直在想如何构建一个灵活的OA工作流机制,可能开始有很多人用domino来做,后来到了ASP.NET的时候,好像大家都醒悟了,公司老板、CTO等都开始嚷嚷要上工作流引擎实现企业信息审批流程化。基于企业的实际需求,公司也在近几年开发了标准企业级的工作流引擎,并获得了双软认证,各项指标及客户反映都不错,其基本思路如下:

首先定义每个操做,就是定义流程步,定义流程步主要包括:操作的接口地址、操作参数、操作类型(起始操作、中间操作等)。定义操作的目的是接着为每个操作设置关系和定义流程时选用这些定义好的操作步。

第二定义操作的参数,有了接口地址外,还需要定义操作参数。

第三是定义操作步之间的关系。就是定义一个流程中每个操作步的前驱、后继的操作步。

第四是定义流程了,必要的信息是流程名称等基本信息和定义流程的各个操作步以及流转规则。流程基本信息就不用说了。流程步定义比较复杂,设置定义步骤类型(起始、中间、终结),入口步骤、出口步骤、通知模式、人员、角色、发送通知的内容。

第五是涉及跳步情况的定义,比如需要根据参数的不同提交到不同的步骤进行审批,这里叫做流程步骤变迁规则设置。设置的内容需要:原步骤、目标步骤、变迁方向(正/负)、条件规则(判断参数时用与还是用或)。接着设置参数和参数值及比较条件


  • 1) 流程模型定义说明
    流程(Process):
    是企业组织对业务过程的工作流语言描述。一个完整的流程包括开始节点,中间节点和结束节点。

    活动(Activity):
    对每一个工作项节点上的内容定义,也包括网关,事件等节点。

    转移(Transition):
    表示起始节点和到达节点之间的状态转移。

    执行者(Performer):
    每一个节点定义的角色和用户,作为活动的执行主体。

  • 2)流程流转实例数据存储说明

    流程实例(ProcessInstance):
    存储业务过程流转数据,包括流程标识,业务数据标识和流程发起时间,当前状态和结束时间等信息。

    活动实例(ActivityInstance):
    存储每个流程节点的实例信息,包括活动节点的标识,状态,接收人,办理时间,结束时间等信息。

    转移实例(TransitionInstance):
    存储每条转移的状态数据,包括转移表示,起始节点信息,到达节点信息。

    任务实例(Tasks)
    活动接收和办理人的信息列表,待办任务和已办任务的数据来源。

  • 2. 流程服务方法调用图示

                                              图2   流程服务接口调用示意

 

  • 流程服务常用的6个API接口具体描述

    流程从启动,运行到最终结束时,需要调用引擎服务API接口。

    1) StartProcess()

    启动流程调用此方法,生成流程实例,并置状态到开始节点之后的任务节点。

    2) RunProcessApp()

    流程运行调用此方法,将当前任务结束,并分发任务给下一步节点的办理人。

    3) JumpProcess()

    跳转到指定的任务节点,有预先指定方式,或运行时动态调用方式。

    4) WithdrawProcess()

    当前任务节点的上一步节点完成人发现办理有误需撤销,调用此方法,重新回到上一步节点。

    5) SendbackProcess()

    当前任务办理人退回任务到上一步执行节点。

    6) ReverseProcess()

    流程结束后仍需返回,由结束节点前的执行人调用此方法,状态回到结束前的节点。

 

  • 官网地址:

        http://www.slickflow.com

  • 网站演示地址:

        http://www.slickflow.com/demo/index

  • Github 地址: 

        https://github.com/besley/Slickflow

  • Codeplex地址:

        http://slickflow.codeplex.com

.NET/.NETCore Workflow Engine With Full Source Code

  1. .NET, .NET CORE version both supported
    Slickflow is an open-source project based on .NET5; It's easy to use engine product into the cross-platform application.

  2. BPMN graphic style process diagram
    Slickflow is using BPMN notation to describe process diagram, the Slickflow designer is HTML5 graph editor and user-friendly to business process communication and business analysis.

  3. High performance with Dapper.NET library
    Dapper is a simple object mapper for .NET and owns the title of King of Micro ORM in terms of speed and is virtually as fast as using a raw ADO.NET data reader. An ORM is an Object Relational Mapper, which is responsible for mapping between database and programming language. (Ref: https://dapper-tutorial.net/dapper)

  4. Multiple databases supported
    Slickflow supports SQLSERVER, ORACLE, MySQL and another database, it implemented by the Dapper.NET extension library. The .net core version using EF core to support different database products.

  5. Workflow patterns supported

    1). Sequence
    the most frequently process pattern
    2). Split/Merge
    support and/or gateway such as and/or split, and/or join, together with condition variables on the transition
    3). Sub-process
    in the main process, a subprocess node can start a new process life cycle.
    4). Multi-instance
    multiple performers processing a task together by multiple task instances. All performers both compete for their task, then the process can be continued on. There are sequence and parallel pattern, and the percentage or count parameters can be set on it to ensue when can go to the next step.

    5). Event interoperation
    process instance and activity instance event delegation service, such as process/activity start, execute and complete.
    6). Timer
    integrated with HangFire library, and with CRON expression supported
    7). Email
    todo or overdue tasks email notification
    8). Withdraw
    withdraw the task after just sent out to next step users.
    9). Sendback
    send back to the previous step user, because of some exceptions.
    10). Resend
    combined after sendback and re-send the task to original sendback users.
    11). Reverse
    reverse the process instance alive when completed.
    12). Jump
    jump the process over by several steps forward or backward.
    13). MessageQueue(RabbitMQ)
    message publishing and subscribing to implement message throwing and catching.

6. Process Version
the process has version property to upgrade a new definition due to the business process changed.
7. XML Cache
the runtime instance use cache to keep the XML process diagram by an expired duration.
8. Sequence Process Code Style
0). Model

//create a simple sequence process diagram by hand code rather than a HTML designer  var pmb = ProcessModelBuilder.CreateProcess("simple-process-name", "simple-process-code");var process = pmb.Start("Start")
	.Task("Task1")
	.Task("Task2")
	.End("End")
	.Store();

1). Start

//start a new process instanceIWorkflowService wfService = new WorkflowService();var wfResult = wfService.CreateRunner("10", "jack")
            .UseApp("DS-100", "Book-Order", "DS-100-LX")
            .UseProcess("PriceProcessCode")
            .Start();

2). Run

//run a process instance to next stepIWorkflowService wfService = new WorkflowService();var wfResult = wfService.CreateRunner("10", "jack")
            .UseApp("DS-100", "Book-Order", "DS-100-LX")
            .UseProcess("PriceProcessCode")
            .NextStepInt("20", "Alice")
            .Run();

3). Withdraw

//Withdraw a activity instance to previous stepIWorkflowService wfService = new WorkflowService();var wfResult = wfService.CreateRunner("10", "Jack")
            .UseApp("DS-100", "Book-Order", "DS-100-LX")
            .UseProcess("PriceProcessCode")
            .OnTask(id)             //TaskID
            .Withdraw();

4). SendBack

//Sendback a activity instance to previous stepIWorkflowService wfService = new WorkflowService();var wfResult = wfService.CreateRunner("20", "Alice")
            .UseApp("DS-100", "Book-Order", "DS-100-LX")
            .UseProcess("PriceProcessCode")
            .PrevStepInt()
            .OnTask(id)             //TaskID
            .SendBack();

9. Rich demo projects
WebDemo, MvcDemo, and WinformDemo project are demonstrated for a different type of enterprise information systems.
10. Target
Slickflow is very suitable for software teams or companies who want to integrate workflow engine into their products.
11. Suggestions
Slickflow is suggested to give programmers a flexible way to integrate workflow engine components into their products or customer projects. The programmers can write their own code segments based on the engine component.
12. Open Source Project License
The product is under Slickflow Open Source Project license.
1). Slickflow software must be legally used, and should not be used in violation of the law, morality and other acts that endanger social interests;
2). Non-transferable, non-transferable and indivisible authorization of this software;
3). The source code can be modified to apply Slickflow components in their own projects or products, but Slickflow source code can not be separately encapsulated for sale or distributed to third-party users;
4). The intellectual property rights of Slickflow software shall be protected by law, and no documents such as technical data shall be made public or sold.
13. Commercial license


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:wps表格同一份表格里点一个单元格就跳转到另一个工作表怎么做?(wps表格整体复制到另一个表格)
下一篇:如何使用WPS表格制作下拉菜(wps制作下拉菜单)
相关文章