工作流模式的学习与总结

 

 

概念:    2

工作流的具体应用    2

工作流的审批模式    3

工作流的分类    3

Basic Control Flow Patterns    3

1.顺序(Sequence)    3

2. 平行拆分(Parallel Split)    4

3. 同步(Synchronization)    5

4. 排他选择(Exclusive Choice)    6

5. 简单合并(Simple Merge)    6

Advanced Branching and Synchronization Patterns    7

6.Multi-Choice    8

7.Structured Synchronizing Merge    9

8. Multi-Merge    10

9. Structured Discriminator    11

28. Blocking Discriminator阻塞鉴别    12

29 (Cancelling Discriminator)取消式鉴别    13

30.Structured Partial Join 结构化的部分参与    13

31 (Blocking Partial Join)    14

32 (Cancelling Partial Join)    15

33 (Generalized AND-Join) 广义的与联系    16

37 (Local Synchronizing Merge)本地化同步合并    17

1    你需要决定要进行同步的分支到底是哪个,是ABC    17

Determination of how many branches require synchronization is made on the basis on information locally available to the merge construct    17

2    你还可以在后面推迟选择你要同步并流,还是不同步。    18

38 (General Synchronizing Merge)一般同步合并    18

这个模式提供一个一般的方法来评价流程中一般同步合并(或者或联接),在包含任意循环的结构中非结构化和高并发的流程都可以用到。    19

41 (Thread Merge)线程合并    19

42(Thread Split)    20

Iteration Patterns    21

Termination Patterns    21

Trigger Patterns    21

 

 

 

 

 

 

 

 

参考资料:

百度百科工作流

http://blog.csdn.net/zhong_jinfeng/category/288390.aspx

http://www.workflowpatterns.com/patterns/control/

http://blog.csdn.net/simonezhlx/archive/2007/04/25/1584275.aspx

 

概念:

工作流(Work Flow)就是工作流程的计算模型,即将工作流程中的工作如何前后组织在一起的逻辑和规则在计算机中以恰当的模型进行表示并对其实施计算。工作流要解决的主要问题是:为实现某个业务目标,在多个参与者之间,利用计算机,按某种预定规则自动传递文档、信息或者任务。

简单地说,工作流就是一系列相互衔接、自动进行的业务活动或任务。我们可以将整个业务过程看作是一条河,其中流过的河水就是待审核的表单。

 

WF工作流包含两种类型的工作流:顺序工作流状态机工作流

顺序工作流提供了一系列有组织的步骤,一般情况下,步骤是逐一执行的。可能有的步骤需要等待某些事件的发生才可以继续执行,但通常情况下顺序工作流一般用于无需人工干预的操作。

状态机工作流提供了一系列的状态。工作流从初始状态开始,到终止状态结束。两个状态之间定义行为进行过渡。通常情况下,状态机工作流对事件作出反应,事件的发生将会使状态发生改变。

 

 

工作流的具体应用

1.关键业务流程:订单、报价处理、采购处理、合同审核、客户电话处理、供应链管理等

2.行政管理类:出差申请、加班申请、请假申请、用车申请、各种办公用品申请、购买申请、日报周报等凡是原来手工流转处理的行政表单。

3.人事管理类:员工培训安排、绩效考评、职位变动处理、员工档案信息管理等。

4.财务相关类:付款请求、应收款处理、日常报销处理、出差报销、预算和计划申请等。

5.客户服务类:客户信息管理、客户投诉、请求处理、售后服务管理等管理等。

6.特殊服务类:ISO系列对应流程、质量管理对应流程、产品数据信息管理、贸易公司报关处理、物流公司货物跟踪处理等各种通过表单逐步手工流转完成的任务均可应用工作流软件自动规范地实施。

 

工作流的审批模式

  审批流程设置分为两种模式:传统模式和比例计算模式

  传统模式是指对审批流程的每个节点设定相应审批人,只有当该节点上的所有人员都通过审批请求后,才可以进入下一个节。

比例计算模式:对于每个审批流程,在建立时先要为其设定一个介于0-100%之间的通过比例,惟有最终的审批结果等于或大于该比例,该审批才可被认为通过。

 

工作流的分类

Basic Control Flow Patterns

1. Sequence(顺序)
2. Parallel Split(平行拆分)
3. Synchronization(同步)
4. Exclusive Choice(排他选择)
5. Simple Merge(简单合并)

Sequence、AND-split(Parallel Split)、AND-join(Synchronization)、XOR-Split(Exclusive Choice)、XOR-join(Simple Merge)。

1.顺序(Sequence)

A task in a process in enabled after the completion of a preceding task in the same process.
工作流中的各个活动在同一个进程中按顺序依次执行。
例子:在"发送货物"之后"发送单据"。

 

1. 理论模型

  这个理论模型十分简单,只是一个工作单元完成了,紧接着无条件执行下一个工作单元。每一个工作流系统都直接实现了这种模式,这个模式是工作流能运行的一个重要基石。

2. 应用

   这个模式清楚明白,但是应用却最为广泛。比较有趣的是许多不同形式的分支,在业务的实践中都可以退化成为顺序模式。如果一个工作单元 A 以后能产生 B、C 并发,则可退化成A、B、C顺序执行;合并的情况亦然。

  不过很显然,分支模式退化成顺序模式,是一种实际操作效率较低的做法。在我遇到过的主要有两种情况会这样做:首先可能是流程设计者的水平不足,其思考走直线不会转弯;其次也有工作流系统无法实现复杂分支的情况,或者实现的代价很高。

而这样做带来的结果就是客户不得不改变自己原有的业务流程,而这种退化性的变更通常是让这个业务流程跑得更慢。但是开发方却很轻易的避开了一些高难度的实现,以及系统实施遇到挫折的时候,可以让责任轻易的转嫁到客户流程再造的失败上面。

 

描述

在同一流程中,一个任务在另一任务完成后才能被激活。

同义词

顺序路由,串行路由。

示例

·         任务"发送账单"在任务"发送货物"之后才能执行。

  • 在检索到客户端文件后才能计算保险索赔。
  • 任务"累计航行里程"在任务"预订航班" 后才能执行。

建议

顺序模式用于对工作流程中连贯的步骤建模,所有的工作流管理系统都支持该模式。

 

There is one context condition associated with this pattern: an instance of the Sequence pattern cannot be started again until it has completed execution of the preceding thread of control (i.e. all places such as p1 in the Sequence must be safe).

这个模式要注意的相关条件:一个顺序模式实例直到之前的控制线程完全结束了,才能再次启动。

Example:

The verify-account task executes after the credit card details have been captured.

The codacil-signature task follows the contract-signature task.

A receipt is printed after the train ticket is issued.

 

验证身份的任务必须在得到所以身体证信息之后才能执行。

codacil-signature 在contract-signature之后执行;

火车票收到后打印收据;


2. 平行拆分(Parallel Split)

The divergence of a branch into two or more parallel branches each of which execute concurrently.
工作流中从一个线程中的一个点拆分为在多个线程中平行执行的多个活动。
例子:活动"付款"激活了"发送货物"以及"通知顾客"的执行。


值得注意的是这个定义来说一般B与C之间是并发的,实现上一般是两个不同的线程/进程。据我所知,许多自开发工作流引擎的公司,至今仍然不存在这一种AND的并发分支概念,而且这样的情况还不少。有兴趣的读者可以去了解一下,绝大部分电子政务的许多审批流程都是基于顺序和条件选择的,"并联审批"这一种说法极少用到。

 

描述

在流程中,需将单进程的某控制点分成可并行执行的多进程控制,于是允许任务同时执行或以任何顺序执行。

同义词

与分支,并行路由, 分叉。

示例

任务"付款"的执行,使得任务"装船"和"通知客户"同时执行能够。

注册"保险索赔"后,两个并行子流程被触发:一个是"校核顾客符合的条款",另一是评估实际损害。

建议

所有的工作流引擎都可能支持并行任务。可区分两种基本的方法:显性与分叉和隐性与分叉。支持显性与分叉结构的工作流引擎(诸如:Visual Workflo)可定义一激活即使能的有多个流出转移的路由选择节点。支持隐性与分叉的工作流引擎(如MQSeries/Workflow) 不提供特殊的路由选择结构――每个任务可有多于一个的流出转移,且每个转移都有相关条件。为达到并行执行的目的,流程设计者须保证流出转移的多个相关条件为真(典型的方法是将条件置为空)。


3. 同步(Synchronization)

The convergence of two or more branches into a single subsequent branch such that the thread of control is passed to the subsequent branch when all input branches have been enabled
工作流中的多个活动在一个点上汇合成一个线程。

The despatch-goods task runs immediately after both the check-invoice and produce-invoice tasks are completed.
例子:活动"归档"在"发票"和"收款"全部完成后被激活。

存在三种情况,但是必然是同时触发的:

  1. A先到,B后到,一起触发;
  2. B先到,A后到,一起触发;
  3. AB同时到,一起触发;

这一模型也较为简单,其中合并方式是等待所有的分支都完成了,在进行下一步的任务。 注意,在并发的语义下,可以明显的看到合并后的工作单元和合并前的工作单元,是一个"同步"的关系,因此这一模式的名字,应该是采用了计算机方面的惯用语。这点后面一些模式的名字可能还会看到这种惯用语,譬如 Thread、Instance 等等。



描述

流程中,多个并行子流程/任务在某点汇聚成一个单进程,从而同步多个进程。

同义词

与结合,结合,同步。

示例

· 任务"存档"在"送票"和"收费"两个任务完成后才能使能。

· "保险索赔"在"核定条款"和"估算实际损伤"后才能计算。

问题

本模式极易为所有支持并行运行的工作流引擎所支持。值得注意的是,对于某些实现,"与连接"的错误应用可能易于造成死锁。

建议

1. 所有可用的工作流引擎支持本模式。典型的是具有可用的同步结构。在某些罕见的情形下,通过对一个多入口的任务定义特殊的开始条件实现同步。

2. 当具有显性的同步结构时,典型的特征是同步器应具有多于一个入口,却只有一个出口。例如,若任务C之前有一以任务A和任务B为输入的同步器,如果已有任务A的实例,当它执行完毕时,同步器将不作处理,而是等待任务B的实例的终止。 另一方法是,在等待任务B时,简单地明了任务A的"额外"实例的数目,然后用相应的任务B的实例匹配它们。

 

 

 

 

4. 排他选择(Exclusive Choice)

The divergence of a branch into two or more branches such that when the incoming branch is enabled, the thread of control is immediately passed to precisely one of the outgoing branches based on a mechanism that can select one of the outgoing branches.


工作流中的一个点,基于决定或者工作流中的数据,流向若干个分支中的一个。


需要注意的是这个"排他"性,只能选择其中一个分支,另外一个分支将不会走下去。一般来说,这个模式的实现一般为在运行时的条件选择,就是条件判断的代码放到XOR 这个结点,然后去根据这些代码去判断下一步的走向。

 

同义词

异或分叉, 条件路径, 开关, 决议。 

示例

任务"计算赔偿金"后继是两个任务"支付赔偿金""联系顾客"中的任一个

建议

1.     类似于"并行分叉",有两种基本策略――某些工作流引擎提供显性的结构以实现"排他选择"模式 (譬如Staffware, Visual WorkFlow), 但是在其它工作流引擎 (MQSeries/Workflow, Verve)中,流程设计者不得不选择转移条件仿效"排他选择"


5. 简单合并(Simple Merge)

The convergence of two or more branches into a single subsequent branch such that each enablement of an incoming branch results in the thread of control being passed to the subsequent branch.

A或B完成后,C被激活,不用考虑同步的问题。

XOR-join,这一模式就是只有一个分支接受,遵循先到先得的原则。只要 A 或 B 任何一个完成,那么 C 就执行。这里遗留了一个问题,如果前面是AND分支,那么剩下后执行的那个结点怎么办呢?这里涉及到了流程设计的实际应用问题,后面讲到其它 join 模式的时候,会更详细的讨论这一个问题。

 

The Simple Merge pattern provides a means of merging two or more distinct branches without synchronizing them. As such, this presents the opportunity to simplify a process model by removing the need to explicitly replicate a sequence of tasks that is common to two or more branches. Instead, these branches can be joined with a simple merge construct and the common set of tasks need only to be depicted once in the process model.

 

简单合并模式提供一种方法合并两个或者多个不同的分支,而不用进行同步。


Examples

 

After the case-payment or provide-credit tasks, initiate the product-receipt task.

在case-payment 或者provide-credit之后,开始product-receipt任务。

 

描述

在流程中某点,需将两个或更多可选分支聚合而不同步;换言之,"合并"在任一入口连接触发时被触发。

同义词

异或连接,,异步连接,合并。

示例

任务"存档索赔"在任务"支付赔偿金""联系顾客"任一之后使能。

 

 

 

其他工作流模式,这些模式属于比较高级的应用,一般很少用到:

Advanced Branching and Synchronization Patterns

何以将这些模式叫"高级"呢?因为从这些模式开始,在技术水平上就把各种工作流产品拉开了距离。因为技术上实现的复杂性,所以许多工作流产品/标准都不一定能直接支持,甚至有些产品无法描述这些流程模式。如果一些研究过早期工作流模式的朋友,可能会发现没有了 Synchronizing Merge 这种模式,因为现在已经被拆分为三个模式:Structured Synchronizing Merge、Acyclic Synchronizing Merge 和 General Synchronizing Merge。

 

6. Multi-Choice
7. Structured Synchronizing Merge
8. Multi-Merge
9. Structured Discriminator
28. Blocking Discriminator
29. Cancelling Discriminator
30. Structured Partial Join
31. Blocking Partial Join
32. Cancelling Partial Join
33. Generalised AND-Join
37. Local Synchronizing Merge
38. General Synchronizing Merge
41. Thread Merge
42. Thread Split

6.Multi-Choice

简单的理解:这种流程主要是体现多选择性,灵活性,从or出来可以是单个的B,C为空;也可以是单

个的C,B为空;还可以是B,C都有;有三种情况。

这个模式的初衷是可以让使用者任意选择后趋的路径,若选择了两个或以上的后续路径,则是产生并发运行的分支。细心的可能会发现,这个模式是 XOR-split、AND-split 更为泛化的一个模式(所谓的"泛化",是概括、继承的意思)。

 

排它模式采取的是只有一个可选项被选定并执行,亦即它对应于排它或。有时,要用到从给定的一组选项中选定多项(而非一项)的结构,于是,引入(非排它)多重选择。

描述

在工作流过程的某点,依据判定或工作流控制数据,选择一个或多个分支。

同义词

条件路径,选择, 或分叉。

示例

执行任务evaluate_damage之后任务contact_fire_department或contact_insurance_company被执行,至少其中之一被执行,但是,也可能两者都被执行。

问题

很多工作流管理斜体中,转移上可以定义条件。这些系统中可直接实现OR-分叉,但是有几种工作流管理系统不能在转移上设置条件,仅提供纯粹的AND-split和XOR-split建模元素 (例如Staffware).。

建议

1. 正如所述,对于可在转移上设置条件的工作流管理系统 (诸如Verve, MQSeries/Workflow, Forte Conductor)实现多重选择是直截了当的,流程设计者只需简单地设定每一转移的条件即可。值得注意的是多重选择是并行分叉和排它选择的泛化。

2. 多重选择的实现需要将并行分叉和排它选择二者结合起来。每一可能的分支由一前置的异或分叉基于控制数据决定,或者激活该分支,或者跳过它。所有异或分叉由一与分叉激活,该与分叉也可用于设置异或分支所用的控制数据。

3. 另一与上述方案类似的方案是颠倒与分叉和异或分叉的结构顺序。每组可激活的并行分支,加入一与分叉。所有与分叉由一前置的异或分叉激活适当的与分叉。注意并非所有的分支组合可行的。所以本方案将导致简单的工作流定义。

 

 

7.Structured Synchronizing Merge

 

 首先这个分支的合并,需要了解上下文的关系。前面若是只产生了 A 分支,那么来到这里只需要 A 分支就可以触发后躯,B 分支亦然。若是 A、B 分支是并发的,那么注意标题中"Synchronizing"的字眼,这个合并必须等待 A、B 分支都完成了才能触发后躯 C。这个模式要看前面多重选择出来的分支是单个还是多个,如多个必须得进行同步,B和A同时满足,这个合并必须等待 A、B 分支都完成了才能触发后躯 C

  顺便提到这一个"Structured"的字眼,在后续的工作流模式里面会常看到。遇到这个字眼多少意味着带有点条件判断的味道。就这个模式本身不能独立的决定合并方式,需要根据上下文的信息来适应不同的情况变化(如:这一个模式需要知道前面的 OR-Split 结点如何分支才能决定合并方式)。

现代的工作流产品很容易处理多路选择模式。不幸的是,对应于合并(Or-Join)结构的实现却极度困难。OR-join应具有同步并发流及合并可选流的功能。困难在于决定何时同步,何时合并。同步可选流导致可能的死锁,合并并发流可能导致不期望的任务多重执行。

描述

流程中某点多条路径聚合成一个线程,若多于一条路径触发,则活动线程需同步;若仅有一条路径触发,则可选分支应再收敛,无需同步。

示例

拓展多重选择模式中的例子,任务contact_fire_department 及contact_insurance_company 任一或二者都完成后(取决于它们是否都不执行),任务submit report 需完成 (仅一次)。

问题

本模式的主要困难在于决定何时同步,何时合并。同步可选流导致可能的死锁,合并并发流可能导致不期望的紧接标准OR-join结构的任务的多重执行。

建议

1. 已知有两种工作流引擎MQSeries/Workflow 和InConcert中直接实现了这个模式。正如前面提及的,若一同步合并后接一OR-split,该 OR-split可触发多于一条流出转移,不必等到运行时方知同步是否应该发生。

2. 在其它工作流引擎中未直接实现本模式。通常的作发是避免明显地使用可能触发多条流出转移的OR-split,而代之以一个AND-splits和XOR-splits的联合。该方法可轻易地使用AND-splits和XOR-splits结构同步相应分支。

 

 

 

 

8. Multi-Merge

多重合并主要有以下几种情况:

B先完成,触发D1,C后完成,触发D2,触发D完毕,结束;

C先完成,触发D1,B后完成,触发D2, 触发D完毕,结束;

BC同时到达,同时触发D,触发D完毕,结束;(说明:实际中却不存在同时完成的情况,计算机处理总有先后次序。)

注意,当 A、B 分支到达这个合并结点的时候,并不是合并,而是继续相同的后续分支。如 A 先完成,那么就触发 C1(这里要区别一下,第一次触发这个 C 我们称之为 C1),然后 B 完成后,再触发C2(第二次触发的 C 叫 C2)。所以实际上是触发了两次 C。按照理论模型来讲,及时 A、B 同时完成,仍然触发两个 C,但实际中却不存在同时完成的情况,计算机处理总有先后次序。

 

描述

多路合并是指在流程中某点,两条或更多分支无同步再收敛。若多于一个分支被激活,可能同时被激活,任务后的合并对于每条流入的激活分支都响应一次(亦即,在上图中,D将被实例化两次)。

示例

有时两个或更多并行的分支共享一个终点。此类情况的翻版是(可能复杂的)流程中每一分支可用一个多路合并。一个简单的例子是两个并行运行的任务audit_application及process_application ,二者都后接任务close_case.。

问题

大多数工作流引擎 (诸如Staffware, HP Changengine, I-Flow)若一个任务的第一个实例仍在运行时,将不产生第二个实例。Verve Worflow 和Forte Conductor例外。

建议

如果多路合并不是循环(loop)的一部分, 作为一个任务不能创建多于一个实例的语言的通用设计模式是在工作流模型中复制该任务。如果多路合并是循环(loop)的一部分, 典型的情况是多路合并其后所接的任务的数目在设计(建模)时未知。关于这个问题的典型方案,见有关多实例模式。

 

 

 

9. Structured Discriminator

这个模式处理的方式主要有三种:

  1. A、B 分支同时执行的情况,如AND-split 使得 A、B 并发,同时到达Discriminator

  2. B先到达Discriminator,C后到达,则C不执行

  1. C先到达Discriminator,B后到达,则B不执行

这种模式只处理 A、B 分支同时执行的情况,最直接的上文是采用 AND-split 使得 A、B 并发执行。这里 A、B 执行,若 A 先完成,则触发后躯结点 C,然后 B 完成以后,则到了这个 Discriminator 后就忽略其执行结果。反之亦然。

 

描述

路径鉴别器是指在流程的某点,激活后续任务之前等待许多流入分支的完成。从它开始之时起,等待所有剩余分支的完成并"忽略"它们。一旦所有的流入分支都被触发,它使自己复位,以便可被再次触发

示例

· 一篇论文需被送给外部审阅者。如果两个评价皆为正,则论文被接受;如果第一个评价为负,应提示作者,不必等待第二个评价。

· 为缩短查询响应时间, 一个复杂的查询通过internet被送往两个数据库。第一个给出结果后流程将继续流转,第二个结果将被忽略。

问题

一些工作流引擎(如Staffware, HP ChangeEngine, I-Flow),若任务的第一个实例仍在运行,则生成该任务的第二个实例。然而,这不能提供一个路由鉴别解决方案,因为只要该任务的第一个实例完成,第二个实例将被创建。

建议

1. Verve中有一个特殊的结构实现路由鉴别语义。

2. 支持定制触发器的产品可实现路由鉴别功能(详见M中选N)

3. 所有其它的工作流引擎很难或无法实现路由鉴别功能。通用的设计模式是采用取消任务模式。只要路由鉴别后接任务的第一个实例被创建, 仍未完成的流入分支的任务可被取消,如此第二个实例将不会被创建。模式见下图。本方案的问题是若任务B和C同时完成, 任务D 可能仍将执行两次。此外, 路由鉴别的原有语义是允许B 和C 都完成。本方案任务B 或C 将被取消。

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/simonezhlx/archive/2007/04/25/1584275.aspx

 

28. Blocking Discriminator阻塞鉴别

The convergence of two or more branches into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when the first active incoming branch has been enabled. The Blocking Discriminator construct resets when all active incoming branches have been enabled once for the same process instance. Subsequent enablements of incoming branches are blocked until the Blocking Discriminator has reset.

在完成一个任务之前必须等到前面的一个完成,这时会发生一定的阻塞。

Example:

一旦确认代表团抵达或安全检查任务完成,该任务可以开始检查证件。虽然这两个任务可以同时执行在实践中,在确认代表团抵达任务总是完成任务前的安全检查。如果前一个实例的任务尚未完成,另一个检查凭据任务实例不能启动。同样,如果在支票上的实例有凭据的任务尚未完成,确认代表团抵达和安全检查任务的后续实例无法启动。

 

 

 

 

29 (Cancelling Discriminator)取消式鉴别

The convergence of two or more branches into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when the first active incoming branch has been enabled. Triggering the Cancelling Discriminator also cancels the execution of all of the other incoming branches and resets the construct.

Example:

抽样任务完成后,部分样品被送到三个不同的实验室检验。一旦这些实验室首次完成了采样分析,另外两个任务实例被取消和审查工作开始。

30.Structured Partial Join 结构化的部分参与

The convergence of two or more branches (say m) into a single subsequent branch following a corresponding divergence earlier in the process model such that the thread of control is passed to the subsequent branch when n of the incoming branches have been enabled where n is less than m. Subsequent enablements of incoming branches do not result in the thread of control being passed on. The join construct resets when all active incoming branches have been enabled. The join occurs in a structured context, i.e. there must be a single Parallel Split construct earlier in the process model with which the join is associated and it must merge all of the branches emanating from the Parallel Split. These branches must either flow from the Parallel Split to the join without any splits or joins or be structured in form (i.e. balanced splits and joins).

Example:

一旦前面的三项支出审批的两项任务已完成,触发发行支票的任务。在允许发行支票任务再次触发之前,等待直到剩下的任务完成。

 

31 (Blocking Partial Join)

 

The convergence of two or more branches (say m) into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when n of the incoming branches has been enabled (where 2 = n < m). The join construct resets when all active incoming branches have been enabled once for the same process instance. Subsequent enablements of incoming branches are blocked until the join has reset.

与上面不同的是,当BCD到达join之后,会在之前的and join做一个阻塞,直到这个join被重设之后再次进来分支。

 

When the first member of the visiting delegation arrives, the check credentials task can commence. It concludes when either the ambassador or the president arrived. Owing to staff constraints, only one instance of the check credentials task can be undertaken at any time. Should members of another delegation arrive, the checking of their credentials is delayed until the first check credentials task has completed.

当访问代表团队的第一个成员到达时,查证开始。在这里我们假设时任总统到达,所以人手不够,只有一个查证实例运行。如果有另一个代表团队访问,检查他们的证会被推迟,直到第一个查证结束。

 

32 (Cancelling Partial Join)

 

The convergence of two or more branches (say m) into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when n of the incoming branches have been enabled where n is less than m. Triggering the join also cancels the execution of all of the other incoming branches and resets the construct.

  1. n个进入的分支开户,且n<m
  2. 触发结点的同时取消执行其他进入的分支,并重设结构;

Examples

Once the picture is received, it is sent to three art dealers for the examination. Once two of the prepare condition report tasks have been completed, the remaining prepare condition report task is cancelled and the plan restoration task commences.

一旦收到相片,就会发送给艺术经销商检查,只要其中两个准备条件报告完成,剩下的准备条件报告就会取消,还有计划恢复任务就会启动。

 

 

33 (Generalized AND-Join) 广义的与联

The convergence of two or more branches into a single subsequent branch such that the thread of control is passed to the subsequent branch when all input branches have been enabled. Additional triggers received on one or more branches between firings of the joinpersist and are retained for future firings. Over time, each of the incoming branches should deliver the same number of triggers to the AND-join construct (although obviously, the timing of these triggers may vary).

 

从A流进一个或者多个分支,在一个或多个被触发的结点之间,保持现有的triggers并保留用于将来的触发,随着时间推移,每一个分支都会传递同样数目的触发者到这个与联接。

Example:

当所有的GET董事签名的任务已经完成,运行完整的合同任务。

积累引擎,底盘和车身部件从各生产线。当每个已收到,使用每个组件之一,组装车。

 

37 (Local Synchronizing Merge)本地化同步合并

 

The convergence of two or more branches which diverged earlier in the process into a single subsequent branch such that the thread of control is passed to the subsequent branch when each active incoming branch has been enabled. Determination of how many branches require synchronization is made on the basis on information locally available to the merge construct. This may be communicated directly to the merge by the preceding diverging construct or alternatively it can be determined on the basis of local data such as the threads of control arriving at the merge.

这个模式,主要注意:

The Local Synchronizing Merge provides a deterministic semantics for the synchronizing merge which does not rely on the process model being structured (as is required for the Structured Synchronizing Merge) but also does not require the use of non-local semantics in evaluating when the merge can fire.

本地同步合并提供一个可决定的语义给同步合并,相对结构化同步合并来说,不需要依赖进程结构模型,在合并被激活时,进行评价的过程中也不需要非本地化语义。

There are two context conditions associated with the use of this pattern: (1) once the Local Synchronizing Merge has been activated and has not yet been reset, it is not possible for another signal to be received on the activated branch or for multiple signals to be received on any incoming branch, i.e. all input places to the Local Synchronizing Merge (place p4 and p5) are safe and (2) the Local Synchronizing Merge construct must be able to determine how many incoming branches require synchronisation based on local knowledge available to it during execution

一旦本地化合并激活并且没有被重新启动,在被激活的分支中它不可能接收另一个信号,在进入的多个信号不可以被接收,所有输入的地方是安全的,在执行过程中,基于本地化的知识,本地合并结构必须可以决定需要同步多少进入分支。

 

你需要决定要进行同步的分支到底是哪个,是A,B,C?

Determination of how many branches require synchronization is made on the basis on information locally available to the merge construct

 

你还可以在后面推迟选择你要同步并流,还是不同步。

 

 

38 (General Synchronizing Merge)一般同步合并

The convergence of two or more branches which diverged earlier in the process into a single subsequent branch such that the thread of control is passed to the subsequent branch when either (1) each active incoming branch has been enabled or (2) it is not possible that any branch that has not yet been enabled will be enabled at any future time.

 

每一个活动的流进的分支都被激活,任何一个分支中还没激活的不可能在将来被激活。

Figure 56 provides an example of the General Synchronizing Merge pattern. It shares a similar fundamental structure to the examples presented in Figures 7 and 55 for the other forms of OR-join however the conditional feedback path from p4 to p1 involving F (which effectively embeds a "loop" within the process where cond3 evaluates to true) means that it is not possible to model it either in a structured way or to to use local information available to E to determine when the OR-join should be enabled.

下图提供一个例子给一般同步合并,分享一个相似其他的基础架构表现或联接,但是这个条件反馈路径:从p4p1涉及到F(有效的嵌入一个循环),它意味着不可能模式化它,不管是从结构化方法,还是使用本地化有效信息到达E,来决定什么时候或联接应该被开户。

 

This pattern provides a general approach to the evaluation of the General Synchronizing Merge (or OR-join) in process. It is able to be used in non-structured and highly concurrent processes including process models that include arbitrary looping structures.

这个模式提供一个一般的方法来评价流程中一般同步合并(或者或联接),在包含任意循环的结构中非结构化和高并发的流程都可以用到。

 

41 (Thread Merge)线程合并

 

At a given point in a process, a nominated number of execution threads in a single branch of the same process instance should be merged together into a single thread of execution.

在一个流程给定的点中,指定数量的线程必须被合并才能继续执行。

There is one context consideration for this pattern: the number of threads needing to be merged (i.e. numinsts) must be known at design-time.

注意:要合并的线程数量必须在设计时就确定好。

 

Note that numinsts indicates the number of threads to be merged.

Numinsts指示要合并的线程数量。

Examples

Instances of the register-vehicle task run independently of each other and of other tasks in the Process Enquiry process. They are created as needed. When ten of them have completed, the process-registration-batch task should execute once to finalise the vehicle registration system records update.

在流程查检过程中,车辆注册实例独立于其他任务的完成,他们的创建是很多必要的,当其中10个完成时,批量注册流程会执行来确保记录升级。

 

42(Thread Split)

这种模式提供了一种在给定的触发流程实例沿着分支多个执行线程的方法。这是对线程合并格局,沿同一分支合并多个执行线程的对应。除非在与线程合并模式一起使用,线程将独立运行到结束。

Examples

At the completion of the confirm paper receival task, initiate three instances of the subsequent independent peer review task

 

 

 

 

 

 

Multiple Instance Patterns

12. Multiple Instances without Synchronization
13. Multiple Instances with a Priori Design-Time Knowledge
14. Multiple Instances with a Priori Run-Time Knowledge
15. Multiple Instances without a Priori Run-Time Knowledge
34. Static Partial Join for Multiple Instances
35. Cancelling Partial Join for Multiple Instances
36. Dynamic Partial Join for Multiple Instances

 

12 (Multiple Instances without Synchronization)

Within a given process instance, multiple instances of a task can be created. These instances are independent of each other and run concurrently. There is no requirement to synchronize them upon completion. Each of the instances of the multiple instance task that are created must execute within the context of the process instance from which they were started (i.e. they must share the same case identifier and have access to the same data elements) and each of them must execute independently from and without reference to the task that started them.

在一个给定的流程实例中,一个任务可以创建多实例。每个实例都相对的独立运行,也没有关必要在完成时同步。其中的各个实例必须执行

举例:

A list of traffic infringements is received by the Transport Department. For each infringement on the list an Issue-Infringment-Notice task is created. These tasks run to completion in parallel and do not trigger any subsequent tasks. They do not need to be synchronized at completion.

运输部门接收到了交通违例清单,对清单上的每个违例,启动了事务违例记录任务。这些任务并行的运行到结束,并且不会触发任何子任务。他们不需要实现同步。

 

 

 

 

Multiple Instances with a Priori Design-Time Knowledge

Within a given process instance, multiple instances of a task can be created. The required number of instances is known at design time. These instances are independent of each other and run concurrently. It is necessary to synchronize the task instances at completion before any subsequent tasks can be triggered.

给定一个进程实例,一个任务多实例被创建。在设计的时候就知道实例的数目。这些实例不互相依赖且独立运行。在任一子任务被触发前,这些实例任务在完成时需要被同步。

举例:年度报告必须在六个高层负责人签名之后才能发布。

Motivation

This pattern provides the basis for concurrent execution of a nominated task a predefined number of times. It also ensures that that all task instances are complete before subsequent tasks are initiatied.

该模式提供依据:指定一个并行执行的预定义的次数。同时也确定在子任务被激发起前所有任务实例结束。

任务实例的个数在设计时应该声明,并且是一个固定值。

流程中的某个任务可能乐于创建多个实例,其数目在设计模型时已知。

描述

某种情形下,一个任务被激活多次,其指定任务在给定情况下实例的个数在设计时已知。

示例

危险材料的申请单要求三次不同的审批。

建议

若实例的个数在设计时已知,一个简单的处理方法是在模型中复制该任务,并结合使用并行执行模式

 

 

 

Pattern 14 (Multiple Instances with a priori Run-Time Knowledge)

Within a given process instance, multiple instances of a task can be created. The required number of instances may depend on a number of runtime factors, including state data, resource availability and inter-process communications, but is known before the task instances must be created. Once initiated, these instances are independent of each other and run concurrently. It is necessary to synchronize the instances at completion

before any subsequent tasks can be triggered.

 

 

在一个给定的进程实例,多个任务实例被创建。这些实例需要的数目可能依靠运行时的因子,包括状态数据,资源有效性和交叉进程交互,但是这些在任务实例被创建前必须知道。一旦开始,这些实例是独立于任意一个其他的实例并且并行运行。而且在其他分支的任务触发前,这些实例必须同步结束。

 

就是任务实例运行到一个阶段的时候,需要用户提供一定的知识,帮助实例向下执行。 具有交互式的特点。

举例:

When diagnosing an engine fault, multiple instances of the check-sensor task can run concurrently depending on the number of error messages received. Only when all messages have been processed, can the identify-fault task be initiated;

当诊断发动机故障时,多实例任务检测传感器任务并行执行,它依赖于接收的错误信息。只有当所有的信息完成接收后,才能开户定义故障的任务。

运行到一个阶段的时候,需要知道提供的信息,得以向下执行。

一个任务的实例个数是动态的,亦即在设计时未知,而在运行期间所有实例需被执行前的某点可获知其数目。可以将本模式看作一初始化该任务的For循环。

描述

在某种情况下,任务可被激活多次,给定任务的实例数在指定情形下是一变量,取决于情况特征或资源的可用性, 但在运行期的某些阶段才已知, 即该任务的实例不得不被创建之前。

示例

l 在将科学论文提交杂志审阅的流程中,任务review_paper被实例化几次取决于论文的内容、受托人的可用性, 以及作者的信任度。

l 对于多本书的订购过程, 任务check_availability 每本书都执行一次。

l 当预定旅行时, 任务book_flight 执行多次,若该旅程包含多个航程。

l 当申请审批包含多项,且每项需不同的人审批。

问题

只有少数工作流管理系统提供指定情况下一个任务的多次激活。大多数系统不得不采取同一任务确定数目的并行实例,或者采用叠代(或重复)结构――其中任务串形处理。

建议

1. 可用任何适用的方案。

2. 若存在可能的最大实例数, 则AND-split 和XOR-split 可用于获取期望的路径。一XOR-split用于选择实例的数目,并触发几个AND-splits之一。每一可能的实例数对应一个带有基数的AND-split。本方法的缺点是使得模型变得庞大且复杂,另为可能的最大实例数所限。

3. 某些工作流引擎提供一特殊结构用于实例化一任务的给定数量的实例。例如MQSeries/Workflow 中的Bundle 。

4. 正如很多情况下,期望的路由行为极易支持――使其更串形化。简单地利用叠代(重复)串形地激活任务的实例。假设任务A 后接任务B 的n个实例且后接任务 C,首先执行A,然后执行B 的第一个实例,每一B 的实例后接一XOR-split来确定需要另一B 的实例或者 C 为下一需执行的任务步。 本方法相当简单。可是,B的n 个实例是非并行执行的但以确定的次序,在很多情形下是无法接受的。请思考论文审阅的例子,显然,第二个审阅者不得不等待第一个审阅者完成审阅后才能审阅是无法让人接受的,等等。

 

 

 

 

Multiple Instances without a Priori Run-Time Knowledge

Within a given process instance, multiple instances of a task can be created. The required number of instances may depend on a number of runtime factors, including state data, resource availability and inter-process communications and is not known until the final instance has completed. Once initiated, these instances are independent of each other and run concurrently. At any time, whilst instances are running, it is possible for additional instances to be initiated. It is neccesary to synchronize the instances at completion before any subsequent tasks can be triggered.

和上面有所不同的是,在运行时,并不需要给定的知识,而是可以任意添加实例。就是总会有意外的实例想要加入时,比较方便。特别是应对额外的任务实例。

The despatch of an oil rig from factory to site involves numerous transport shipment tasks. These occur concurrently and although sufficient tasks are started to cover initial estimates of the required transport volumes, it is always possible for additional tasks to be initiated if there is a shortfall in transportation requirements. Once the whole oil rig has been transported, and all transport shipment tasks are completed, the next task (assemble rig) can commence.

石油装备的发货从出厂到目的地涉及到众多的运输装货任务,这些都是同时进行的,虽然需要的运输量在一开始就估计好足够的任务,但在运输的过程中,如果有需要的差额要补充时,总是可能有额外的任务新增,一旦整个石油装备被运输完毕,所以的装货任务结束,下一个任务可以开始。

 

实例的数目是动态的,亦即实例数设计时不知,在运行期间,所有这些实例需要被激活前的任何阶段都无法知道。可将本模式看作是任务实例化的WHILE循环。

描述

某种情况下任务可激活多次,然实例数设计时不知,在运行期间,所有这些实例不得不被创建之前的任何阶段都无法预知。

示例

100台计算机的订单,然供货商数目未知。每一供货商交付的计算机数量未知,因之,交付的综述事先未知。每次交货后,通过比较已截止目前已交付的总数和需求数量来确定是否还有下次交易。

问题

大多数工作流引擎不允许同一任务多于一个实例同时激活。

建议

1. 本模式的最简单实现是利用循环和并行分叉结构,只要工作流引擎直接支持多实例。在Forte 和Verve中是可行的。

2. 某些工作流支持额外的结构使得设计器可创建子流程(subprocess 或subflow ),从主流程中分离且并行执行。例如, Visual WorkFlo 支持Release 结构、I-Flow 支持Chained Process Node.。

3. 若工作流支持特殊的结构――孵化子流程, 那么可通过调用子流程――作为流程中任务的一部分。

4. 同样运行时已知实例数的多实例模式,期望的路径行为通过使其有序执行极易支持

 

 

 

 

Pattern 34 (Static Partial Join for Multiple Instances)

Within a given process instance, multiple concurrent instances of a task (say m) can be created. The required number of instances is known when the first task instance commences. Once n of the task instances have completed (where n is less than m), the next task in the process is triggered. Subsequent completions of the remaining m-n instances are inconsequential, however all instances must have completed in order for the join construct to reset and be subsequently re-enabled.

 

 

在一个给定的进程实例里面,多个并行的任务实例(M个)被创建,当第一个任务实例开始的时候要知道需要实例数目。一旦N个任务实例已经完成(注意N小于M),在进程中下一个任务被触发,

 

举例:Examine 10 samples from the production line for defects. Continue with the next task when 7 of these examinations have been completed.

在检测中从生产线中测试10个样品,当7个这些检查完成后继续下一个任务。

注意:在运行控件流前,必须选择M,N,假设M=3,N=2,当运行到B,只要有两个C触发,小球进入D。

 

Pattern 35 (Cancelling Partial Join for Multiple Instances)

Within a given process instance, multiple concurrent instances of a task (say m) can be created. The required number of instances is known when the first task instance commences. Once n of the task instances have completed (where n is less than m), the next task in the process is triggered and the remaining m-n instances are cancelled.

 和上面有点不同,在运行第一个任务实例时,需要知道有多少个实例,一旦任务完成,接下来的进程被触发,剩下的m-n实例被取消。

Examples

Run 500 instances of the Protein Test task with distinct samples. Once 400 of these have completed, cancel the remaining instances and initiate the next task.

Pattern 36 (Dynamic Partial Join for Multiple Instances)

Within a given process instance, multiple concurrent instances of a task can be created. The required number of instances may depend on a number of runtime factors, including state data, resource availability and inter-process communications and is not known until the final instance has completed. At any time, whilst instances are running, it is possible for additional instances to be initiated providing the ability to do so had not been disabled. A completion condition is specified which is evaluated each time an instance of the task completes. Once the completion condition evaluates to true, the next task in the process is triggered. Subsequent completions of the remaining task instances are inconsequential and no new instances can be created.

 

给定一个进程实例,多个并发的任务实例被创建。需要的进程数目依赖于运行时因子,包括状态数据,资源有效性和进程之间的通信,并且它是直到最后一个任务完成的时候才知道进程的数目。因为这是动态的,不确定的。在任意时间里面,只要实例在运行,就有可能新增额外的实例(如果没有设置成disabled).这个任务的实例指定一个完成的条件,每次都会被评估。一旦这个完成条件为真的时候,下一任务就会触发。随后剩下的任务实例不重要,并且不会产生新的实例。

举例:

The despatch of an oil rig from factory to site involves numerous transport shipment tasks. These occur concurrently and although sufficient tasks are started to cover initial estimates of the required transport volumes, it is always possible for additional tasks to be initiated if there is a shortfall in transportation requirements. Once 90% of the transport shipment tasks are complete, the next task (invoice transport costs) can commence. The remaining transport shipment tasks continue until the whole rig has been transported.

 

这个例子和Multiple Instances without a Priori Run-Time Knowledge不同的是,一旦有90%的运输任务完成,下一个任务如货物费用就可以开始了,剩下的运输任务继续直到整个装备运输完毕。

 

 

State-based Patterns

16. Deferred Choice
17. Interleaved Parallel Routing
18. Milestone
39. Critical Section
40. Interleaved Routing

 

Pattern 16 (Deferred Choice)

A point in a process where one of several branches is chosen based on interaction with the operating environment. Prior to the decision, all branches represent possible future courses of execution. The decision is made by initiating the first task in one of the branches i.e. there is no explicit choice but rather a race between different branches. After the decision is made, execution alternatives in branches other than the one selected are withdrawn.

 

在一个进程中有一点是:几个分支中其中一个是基于操作环境的交互。在决定之前,所有的分支代表将来可能执行的路线。在其中一个分支中通过发起第一个任务做出这个决定,没有明确的选择。在做出决定之后,其他备选方案被撤销。

举例:

At the commencement of the Resolve complaint process, there is a choice between the Initial customer contact task and the Escalate to manager task. The Initial customer contact is initiated when it is started by a customer services team member. The Escalate to manager task commences 48 hours after the process instance commences. Once one of these tasks is initiated, the other is withdrawn.

在解决投诉的进程,在客户联系和提交到经理两个任务中有一个选择。一旦选择其中一个,另一个被撤销。

描述

流程某点几个分支中之一被选中,相对于XOR-split的是, 选择不是显性的 (例如基于数据或判定) 但有几个可选路径;然而,相对于AND-split, 仅有一个可选路径被执行。这意味着环境激活可选分支之一,其余分支忽略。请注意,重要的是该选择延期到可选分支之一确实启动之时, 亦即选择的时刻仅可能迟。

同义词

外部选择, 隐性选择(implicit choice.)

示例

· 接收产品时有两条途径将产品运往部门,选择是基于相应资源的可用性,因之,选择延期到一个资源可用。

· 考虑任务send_questionnaire, 后接任务time_out 和process_questionnaire,任务time_out 要求一个时间触发器, 任务process_questionnaire 只在回复从接收方返回时执行(所以其执行需要一外部触发器)。明显地,在任务process_questionnaire 和time_out 作选择时应越迟越好。若这样的选择被建模成一个显性的XOR-split , 可能在回复表单到达是被拒收, 亦或若无回复返回时锁定流程。

问题

很多工作流管理系统支持 XOR-split, 但不支持隐性 XOR-split。由于两个选择都是期望的, 缺乏隐性 OR-split 是一个实在的问题。

建议

1. 假设所用的工作流语言支持AND-split 和Cancel Activity 模式,隐性XOR-split可借助一AND-split激活所有可选分支实现。只要可选分支之一的处理开始,所有其它可选分支被取消。请考虑上图中在任务B 和C 之间的隐性选择,任务A之后, 激活任务 B 和C,只要B 被选中或执行,任务C 被取消(无它法)。请注意,该方法常常不可行,因为B 和 C 可被同时选中或执行。

2. 解决此问题的另一方法是由一显性XOR-split代替隐性XOR-split,亦即增加一额外任务。所有触发器激活的可选分支被重定位到一新加的任务。假设任务可以在触发器之间区分, 则它可激活适当的分支。请注意,此方法将部分路由移入应用或任务(应用中的任务)层。

 

 

 

 

Pattern 17 (Interleaved Parallel Routing)交错并发路由模式

A set of tasks has a partial ordering defining the requirements with respect to the order in which they must be executed. Each task in the set must be executed once and they can by completed in any order that accords with the partial order. However, as an additional requirement, no two tasks can be executed at the same time (i.e. no two tasks can be active for the same process instance at the same time).

 

一组任务有一些预先定义的执行顺序,每个任务在这个组中必须执行一次,完成的次序取决于特定的次序。作为一个额外需求,没有两个任务在同一时间被执行。

举例子:

When despatching an order, the pick goods, pack goods and prepare invoice tasks must be completed. The pick goods task must be done before the pack goods task. The prepare invoice task can occur at any time. Only one of these tasks can be done at any time for a given order.

当执行一个订单的时候,挑选货物,包装货物,准备发票这些任务必须完成。包装货物前必须完成挑选货物。准备发票可以任何时候做。在给定的次序中,在这些任务中只有一个任务准备发票可以在任何时间内去完成的。

 

AND-split 和AND-join模式典型地用于定义并发路由。大多数工作流管理系统支持真正的并行, 亦即两个任务同时被执行。若这些任务共享数据或资源,真正的并行是不可能的或者导致紊乱,诸如丢失更新的数据或死锁。

描述

一组任务的以任意顺序执行:组中的每一任务被执行, 执行顺序运行时决定, 没有两个任务在同一时刻执行 (亦即同一流程实例同一时刻没有两个任务活动。

同意词

无序串形。

示例

· 海军要求每个工作申请必须进行两项测试: physical_test 和mental_test。这些测试可以任意顺序进行,但不能同时进行。

· 每年年终时,银行对每一帐户执行两项任务: add_interest 和charge_credit_card_costs。这些任务可以任意顺序执行,但是由于都要更新帐户数据,它们不能同时执行。

问题

由于多数工作流管理系统支持并行执行――利用诸如AND-split 和AND-join这样的结构, 不可能定义交叉并行路由。

建议

1. 固定执行顺序,亦即将并行执行代之以串形执行。由于任务可以任意顺序执行,采用预定义执行顺序的方法是可以接受的。但是, 固定执行顺序, 就降低了柔性,且所有潜在的资源不能被利。

2. 利用XOR-split 和Sequence的混合, 亦即确定几个可选次序,执行前通过一 XOR-split选择一个次序;缺点是开始执行前次序是确定的。然而, 工作流模型由于列举所有可能的次序而可能变得非常复杂和庞大。

3. 通过利用延期XOR-Split (而非XOR-split),次序在执行前不必固定,亦即隐性OR-split 允许机动次序的选择。不幸的是, 模型中经常会包含一个空心粉条状的结构。

4. F对于基于Petri网的工作流模型, 任务的交叉须得强制加入一个位置――作为所有潜在并行任务输入及输出的地方。AND-split增加一个令牌到该处, AND-join从该处去除索价令牌。易见如此的位置实现了所要求的"互斥现象"。

 

 

里程碑(Milestone)

 

这个模式允许测试一个流程是否到达某一阶段。到达某些阶段时,就取消一些以前允许运行的任务。

描述

任务节点的可用性取决于特定的状态条件,也就是说任务只有在某一里程碑已经达到并且还没有过期的时候才可被激活。假设有3个任务A,B,C,任务A只有在任务B已经被执行,并且C还没有被执行的情况下才被激活,亦即A在B执行前是不可被激活的,在C执行后A又是不可被激活的。

同义词

测试临界点,最终期限,状态条件

示例

· 假设一个处理控告的流程,第一步,控诉材料被登记注册(register任务),然后平行的一个调查表发送给原告(send_questionnaire任务),同时控告材料需要进行评估(evaluate任务)。如果在2周内,原告送回了调查表,任务process_questionnaire 执行完成。如果在2周内,原告没有送回调查表,调查表的调查结果被放弃(任务time_out) 根据对控告材料的评估结果,决定是否受理。实际的控诉受理(process_complaint任务)必须等调查表被处理完成或者已经超时,才可以进行。对控告的处理结果需要通过check_processing任务的检查。最后归档任务(archive)被执行。

· 在一旅行社,航班机票、汽车租赁、旅馆等在发票还没有打印出来的时就可以预定。

· 一个顾客可以直到规定的交付日期前2天退掉其购买的商品。

· 一个顾客可以乘机6个月后向航空公司索赔。

问题

这个问题与在延期选择模式中提到的问题很相似。在许多的任务之间这里有一个竞争,一些任务的执行会导致别的不能执行。注意,在控告登记例子中,任务 process_complaint 可被执行任意多次,也就是可能不执行process_complaint, 也可能执行多次。

 

建议

1. 假设有3个任务 A、B和 C,任务 A 在任务C执行前和任务B执行后可以执行任意多次。这样的里程碑可以用延期选择模式实现。任务B开始执行之后,可以设置一含有两个并行任务的延期选择:B、C,若B被执行完后,同样的延迟选项被激活。如果C执行完了,B被延迟选项设置成不起作用。注意,这种方法只有在B的执行不受别的并行线程控制的条件下才可以工作。例如,这种结构在控告登记例子里就不可以用,因为process_complaint 只有在一个积极的评估或者一个消极的检查之后才可以直接执行。亦即,process_complaint 的执行受两个并行的线程制约。

2. 另一方法是使用数据透视法,例如,引入一Boolean 流程变量m。再次假设3个任务A, B和C ,任务 A 在任务B和C之间才可以被执行。起始,m 被设置成 false。在B执行完后,m 设置成true, 同样的任务 C 将 m 设置成 false。任务 A 由一个周期m值的循环来执行:如果 m 是 true, 则 A 是激活;如果m 是 false, 则过一个指定的周期后再检查条件。注意这是一个激活等待(busy wait)方法。可使用更多成熟的本方法的变种(或派生),如使用数据库的触发器等。但是,其缺点是,部分流程的真正处理被隐藏到任务和应用中。此外,混合使用并行模式和选择模式会导致各种各样的并发问题。

 

Pattern 39 (Critical Section)

Two or more connected subgraphs of a process model are identified as "critical sections". At runtime for a given process instance, only tasks in one of these "critical sections" can be active at any given time. Once execution of the tasks in one "critical section" commences, it must complete before another "critical section" can commence.

在一个流程里面,两个或者更多的联系子图被定义为临界部分。在运行时,在任何给定的时间里面只有一个任务可以被激活,一旦其中的一个临界部分开始执行,另一个临界部分必须等待它结束才能开始。

 

Examples

Both the take-deposit and insurance-payment tasks in the holiday booking process require the exclusive use of the credit-card-processing machine. Consequently only one of them can execute at any given time.

在暑假预订流程Take-deposit and insurance-payment 任务需要单独使用credit-card- processing机器。因此在给定的时间内,只有一个可以执行。

 

Pattern 40 (Interleaved Routing)

 

Each member of a set of tasks must be executed once. They can be executed in any order but no two tasks can be executed at the same time (i.e. no two tasks can be active for the same process instance at the same time). Once all of the tasks have completed, the next task in the process can be initiated.

 

一组任务里面的成员必须执行一次。它们可以任意顺序执行,但在同一时间内不能有相同的两个执行(没有两个任务可以在同一个流程实例在同一时间内被激活)一旦所有的任务被完成,在流程中的下一个任务启动。

举例:

The check-oil, test-feeder, examine-main-unit and review-warranty tasks all need to be undertaken as part of the machine-service process. Only one of them can be undertaken at a time, however they can be executed in any order.

machine-service流程的Check-oil,test-feeder,examine-main-unit,review-warranty任务都需要去做。在同一时间内,只能执行其中一个。但是他们可以不同顺序执行。

 

 

Cancellation and Force Completion Patterns

19. Cancel Task
20. Cancel Case
25. Cancel Region
26. Cancel Multiple Instance Activity
27. Complete Multiple Instance Activity

 

 

Pattern 19 (Cancel Task)

An enabled task is withdrawn prior to it commencing execution. If the task has started, it is disabled and, where possible, the currently running instance is halted and removed.

在开始执行之前会有一个取消任务被激活,如果这个任务已经开始,disabled 都会中止和移除当前运行实例。

Example:

 

The purchaser can cancel their building inspection task at any time before it commences.

买方可以在开始之前的任意时间取消楼宇检查任务。

作用:

The Cancel Task pattern provides the ability to withdraw a task which has been enabled or is already executing. This ensures that it will not commence or complete execution

 

Pattern 20 (Cancel Case)

A complete process instance is removed. This includes currently executing tasks, those which may execute at some future time and all sub-processes. The process instance is recorded as having completed unsuccessfully.

一个完整的实例被移除。其中包括执行中的任务,可能还有将来要执行的和所有子流程。这个流程实例被记录不成功完成。

 

During an insurance claim process, it is discovered that the policy has expired and, as a consequence, all tasks associated with the particular process instance are cancelled;。

[原文]

在保险索赔过程中,发现了这个政策已经过期,其结果是,所有相关工作的具体过程实例被取消了

 

描述

一个案例,亦即流程实例, 被完全取消。

同义词

撤销流程。

示例

·         在雇佣新员工的过程中,一个申请者撤销其申请。

·         在最终判决之前客户撤销保险索赔。

问题

工作流管理系统常常不支持取消整个流程。

建议

1.     取消任务模式可以被流定义中的每一任务重复。流程中没有一触发每一任务撤销的任务。请注意,这个方法不是最好的,因为"正常的控制流"和仅由去除流程实例引入的各种各样的关系纠缠在一起。

2.       类似于取消任务模式,多数工作流管理系统支持利用一API取消流程――简单地从数据库中去除相应的记录(或项目)。

 

Pattern 25 (Cancel Region)

Description

The ability to disable a set of tasks in a process instance. If any of the tasks are already executing (or are currently enabled), then they are withdrawn. The tasks need not be a connected subset of the overall process model.

在一个流程实例中,有能力关闭一组任务,如果有任何任务已经执行或者当前激活,取消他们。这个任务不会关联到整个流程模型的子集。也就是说不会影响到其他子集的执行。

 

Stop any tasks in the Prosecution process which access the evidence database from running.

[原文]

在所获得的证据起诉运行过程中,停止任何任务

 

 

Pattern 26 (Cancel Multiple Instance Task)

Within a given process instance, multiple instances of a task can be created. The required number of instances is known at design time. These instances are independent of each other and run concurrently. At any time, the multiple instance task can be cancelled and any instances which have not completed are withdrawn. Task instances that have already completed are unaffected.

在给定的一个流程实例中,多实例任务被创建。在设计的时候就知道需要实例的数目。这些实例相互独立并发。在任意时间,多重实例任务和任务实例没有完成的可以撤销。任务实例已经完成的没有影响。

Run 500 instances of the Protein Test task with distinct samples. If it has not completed one hour after commencement, cancel it.

对蛋白质测试任务不同的样品进行500个实例测试,如果一小时内没有完成,取消它。

 

Pattern 27 (Complete Multiple Instance Task)

Within a given process instance, multiple instances of a task can be created. The required number of instances is known at design time. These instances are independent of each other and run concurrently. It is necessary to synchronize the instances at completion before any subsequent tasks can be triggered. During the course of execution, it is possible that the task needs to be forcibly completed such that any remaining instances are withdrawn and the thread of control is passed to subsequent tasks.

 

给定一个流程实例,创建一个任务多实例,在设计的时候就知道实例的数目。实例是并发独立的。在其他分支被触发之前,实例在完成时必须被同步。在执行的过程中,这个任务可能需要被强制完成,如剩下的任务被撤销或者传递控制给其他任务。

Run 500 instances of the Protein Test task with distinct samples. One hour after commencement, withdraw all remaining instances and initiate the next task.

对蛋白质测试任务不同的样品进行500个实例测试,在一个小时之后撤销剩下的实例并且启动下一个任务。

 

Iteration Patterns 迭代模式

The following patterns deal with capturing repetitive behaviour in a workflow.

10. Arbitrary Cycles
21. Structured Loop
22. Recursion

 

 

 

 

Pattern 10 (Arbitrary Cycles) 任意循环模式

The ability to represent cycles in a process model that have more than one entry or exit point. It must be possible for individual entry and exit points to be associated with distinct branches.

在一个多于一个入口点和出口点的流程模板,它能够代表循环。它可以为单独的入口和出口提供连接到不同的分支。

 

 

Pattern 21 (Structured Loop) 结构循环模式

The ability to execute a task or sub-process repeatedly. The loop has either a pre-test or post-test condition associated with it that is either evaluated at the beginning or end of the loop to determine whether it should continue. The looping structure has a single entry and exit point.

有能力重复执行一个任务或者一个子流程,这个循环有一个预测试或者后测试条件,在开始评估或者在结束评估决定是否继续。这个循环结构有一个单独的入口和出口点。

 

 

Example:

While the machine still has fuel remaining, continue with the production process.

当机器还有燃料时,继续生产。

Only schedule flights if there is no storm task.

Continue processing photographs from the film until all of them have been printed.

Repeat the select player task until the entire team has been selected.

 

 

Pattern 22 (Recursion) 递归模式

The ability of a task to invoke itself during its execution or an ancestor in terms of the overall decomposition structure with which it is associated.

 

当它执行的时候或者就其整个分解的结构而言,这一个任务可以调用它自身。

[原文]

 

一个一一些单位 一

 

 

 

 

Examples

An instance of the resolve-defect task is initiated for each mechanical problem that is identified in the production plant. During the execution of the resolve-defect task, if a mechanical fault is identified during investigations that is not related to the current defect, another instance of the resolve-defect is started. These subprocess can also initiate further resolve-defect tasks should they be necessary. The parent resolve-defect task cannot complete until all child resolve-defect tasks that it initiated have been satisfactorily completed.

在一个生产的工厂里面,resole-defect任务的一个实例被启动检查机器问题。在执行这个任务的过程中,如果一个机器故障在检测中不是因为当前的检测,另一个实例开始。这些子流程也可以激活更多更好的子任务。但父任务直到子任务结束了,才圆满完成。

For some types of task, simpler and more succinct solutions can be provided through the use of recursion rather than iteration.[原文]

对于某些类型的任务,更简单和更简洁的解决方案可以通过使用递归而不是迭代。

 

In order to harness recurive forms of problem solving within the context of a process, a means of describing a task execution in terms of itself (i.

[原文]

为了治理recurive形式的解决问题的过程中,一种描述一个任务执行的(即本身对于一个任务的能力来调用的又一个例子本身而执行)。

 

 

Termination Patterns

The following patterns deal with the circumstances under which a workflow is considered to be completed.

11. Implicit Termination
43. Explicit Termination

 

Pattern 11 (Implicit Termination) 隐式终止

Description

A given process (or sub-process) instance should terminate when there are no remaining work items that are able to be done either now or at any time in the future and the process instance is not in deadlock. There is an objective means of determining that the process instance has successully completed.

当没有剩余工作项目可以做,给定的流程或者子流程实例应该终止。有一个客观方式决定实例已经成功完成了。

Pattern 43 (Explicit Termination)显式终止

A given process (or sub-process) instance should terminate when it reaches a nominated state. Typically this is denoted by a specific end node. When this end node is reached, any remaining work in the process instance is cancelled and the overall process instance is recorded as having completed successfully, regardless of whether there are any tasks in progress or remaining to be executed.

当到达一个指定的状态的时候,一个给定过程(或sub-process)情况应该终止,这是典型的,通过引入一个特定的最终节点,当到达这最终节点,剩余的工作过程实例被取消,整个过程实例为成功完成,无论是否存在任何任务进程或剩余的执行。

 

Trigger Patterns

The following patterns deal with the external signals that may be required to start certain tasks.

23. Transient Trigger
24. Persistent Trigger

Pattern 23 (Transient Trigger)

The ability for a task instance to be triggered by a signal from another part of the process or from the external environment. These triggers are transient in nature and are lost if not acted on immediately by the receiving task. A trigger can only be utilized if there is a task instance waiting for it at the time it is received.

 

一个任务实例可以通过从另一个流程的部分或者从外部的环境信号触发,这个触发是瞬间即逝很自然的,并且如果不接收任务马上激活的话,就会丢失。在一个任务实例等待接收的时候只有一个触发可以使用。

Example:

  • Start the Handle Overflow task immediately when the dam capacity full signal is received.

    [原文]

     当大坝容量满的信号被接收的时候马上开始处理溢出的事情。

  • If possible, initiated the Check Sensor task each time an alarm trigger signal is received.

    [原文]

     如果可能的话,检查传感器的任务,每次触发信号接收报警

Pattern 24 (Persistent Trigger)

The ability for a task to be triggered by a signal from another part of the process or from the external environment. These triggers are persistent in form and are retained by the process until they can be acted on by the receiving task.

与上面不同的是,这个触发是持续并且被流程保留的,直到被任务接收激活后。

Example:

Initiate the Staff Induction task each time a new staff member event occurs.

[原文]

  每次一组新职员的事件发生,启动员工介绍任务。

Start a new instance of the Inspect Vehicle task for each service overdue signal that is received.

[原文]

 当每个服务期限信号接收时,启动新的实例检查汽车的任务。

 

 

工作流的优点:

 企业实施工作流管理所带来的好处是非常明显的,这包括提高企业运营效率、改善企业资源利用、提高企业运作的灵活性和适应性、提高工作效率、集中精力处理核心业务、跟踪业务处理过程、量化考核业务处理的效率、减少浪费、增加利润、充分发挥现有计算机网络资源的作用。实施工作流将达到缩短企业运营周期、改善企业内(外)部流程、优化并合理利用资源、减少人为差错和延误,提高劳动生产率等目的。

posted on 2010-08-05 14:16  SUNJUNLIN  阅读(7433)  评论(0编辑  收藏  举报

导航