工作流引擎是什么?開源工作流引擎
工作流引擎是什么?
工作流引擎,軟件開發中不可避免的重要一環。
所謂工作流引擎,是指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
.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.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.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)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.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小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。