OCEB2BI 02 Business Process Modeling with BPMN
Module 2. Business Process Modeling with
BPMN⌘
References⌘
- Business Process Model and Notation (BPMN), V2.0
- Debevoise, Execution Semantics: Moving BPMN to Execution, White Paper.
- Kurz, Menge, and Misiak, Diagram Interchangeability in BPMN 2, White Paper.
Language Elements⌘
Data Modeling⌘
- Data modeling is used to describe physical or information items that are created, manipulated, and used during the execution of a Process.
- Data can be modeled using: Data Objects, Data Inputs, Data Outputs, Data Stores, Data Associations, ....
Data Objects⌘
- The primary construct for modeling data within the Process flow.
- Data Associations are used to move data between Data Objects.
- Tokens do not flow along a Data Association.
Data Object - collection⌘
Data Object - Lifecycle and Accessibility⌘
- Lifecycle of a Data Object is tied to the lifecycle of its parent Process or Sub-Process.
- When a Process or Sub-Process is instantiated, all Data Objects contained within it are also instantiated.
- When a Process or Sub-Process instance is disposed, all Data Object instances contained within it are also disposed. At this point the data within these instances are no longer available.
- Accessibility of a Data Object is driven by its lifecycle.
- The data within a Data Object can only be accessed when there is guaranteed to be a live Data Object instance present.
- Data Object can only be accessed by its immediate parent (Process or Sub-Process), or by its sibling Flow Elements and their children
Lifecycle and Accessibility Example 1⌘
Lifecycle and Accessibility Example 2⌘
Data Input, Data Output⌘
- Activities and Processes often need data in order to execute.
- In addition they can produce data during or as a result of execution.
- Data requirements are captured as Data Inputs.
- Data that is produced is captured using Data Outputs
Data Store⌘
- A DataStore provides a mechanism for Activities to get or update stored information that will persist beyond the scope of the Process.
- Represents a single unit of information (e.g. database record)
Global Task and Global Process⌘
- A Global Task is a reusable, atomic Task definition that can be called from within any Process by a Call Activity.
- A Global Task is not defined within a Process, but is callable element.
- The types of Global Tasks are only a subset of standard Tasks types: GlobalUserTask, GlobalManualTask, GlobalScriptTask, and GlobalBusinessRuleTask
- A Global Process can be called from another Process.
- Question: Do you know any example of non-global process?
Call Activity⌘
- A Call Activity is a type of Activity that identifies a point in the Process where a global Process or a Global Task is used.
Events: Escalation, Compensation⌘
Escalation⌘
- An Escalation identifies a business situation that a Process might need to react to.
- In contrast to an Error, an Escalation by default is assumed to not abort the Activity to which the boundary Event is attached.
Escalation Example⌘
Compensation⌘
- Compensation is undoing steps that were already successfully completed, because their results and possibly side effects are no longer desired and need to be reversed.
- If an Activity is still active, it cannot be compensated, but rather needs to be canceled.
- Compensation is not an error handling
- A compensation handler performs the steps necessary to reverse the effects of an Activity.
Compensation handler⌘
- A compensation handler connected via a boundary Event can only perform “black-box” compensation of the original Activity.
- Compensation Activity is connected to the boundary Event through an Association.
- The Compensation Activity can be either a Task or a Sub-Process, has a marker to show that it is used for compensation only and is outside the normal flow of the Process.
Event Sub-Processes⌘
- Event Sub-Processes allow to handle an Event within the context of a given Sub-Processes or Process.
- An Event Sub-Process always begins with a Start Event, followed by Sequence Flows.
- Event Sub-Processes are a special kind of Sub-Process: they create a scope and are instantiated like a Sub-Process, but they are not instantiated by normal control flow but only when the associated Start Event is triggered.
Event Sub-Processes⌘
- Event Sub-Processes are self-contained and MUST not be connected to the rest of the Sequence Flows in the Sub-Processes; also they cannot have attached boundary Events.
- They run in the context of the Sub-Process, and thus have access to its context.
- An Event Sub-Process cancels execution of the enclosing Sub-Process, if the isInterrupting attribute of its Start Event is set. If the isInterrupting attribute is not set, execution of the enclosing Sub-Process continues in parallel to the Event Sub-Process.
Compensation Using Event Sub-Process⌘
A Compensation Event Sub-Process can: access data that is part of its parent, recursively trigger compensation for Activities contained in its parent, contain compensation start event.
Complex Gateway⌘
- The Complex Gateway can be used to model complex synchronization behavior
- For example, it could specify that tokens on three out of five incoming Sequence Flows are needed to activate the Gateway.
Complex Gateway Attributes⌘
- activationCondition: Expression
Determines which combination of incoming tokens will be synchronized for activation of the Gateway. - activationCount: integer
Refers at runtime to the number of tokens that are present on an incoming Sequence Flow of the Complex Gateway. - waitingForStart: boolean = true
Represents the internal state of the Complex Gateway. It is either waiting for start (=true) or waiting for reset (=false).
Complex Gateway Example⌘
Advanced BPMN Usage⌘
Different types of loops⌘
- Activities may be repeated sequentially, behaving like a loop (Standard Loop Characteristics)
- Desired number of Activity instances that may execute in parallel or may be sequential can be specified. (Multi-Instance Characteristics)
Standard Loop ⌘
- The Activity will loop as long as the boolean loopCondition is true
- The condition is evaluated for every loop iteration, and MAY be evaluated at the beginning or at the end of the iteration (testBefore = true lub testBefore = false)
- In addition, a numeric cap can be optionally specified - loopMaximum
- Loop activity instances are sequentially executed - one after another.
- Loop Activity is similar to DO WHILE loop.
QUESTION: How many times can looping task be executed?
Multi-Instance Activity⌘
- The instances MAY execute in parallel or MAY be sequential.
- Multi-Instance Activites are used with collection of items
- Multi-Instance Activity is similar to FOR EACH loop
Multi-Instance Activity Example⌘
Multi-Instance Loop core attributes⌘
|
isSequential: boolean = false |
This attribute is a flag that controls whether the Activity instances will execute sequentially or in parallel. |
|
completionCondition: Expression [0..1] |
This attribute defines a boolean Expression that when evaluated to true, cancels the remaining Activity instances and produces a token. |
|
loopCardinality: Expression [0..1] |
A numeric Expression that controls the number of Activity instances that will be created |
Basic error handling⌘
- An Error is generated when there is a critical problem in the processing of an Activity or when the execution of an Operation failed
Error Example 1⌘
Error Example 2⌘
Error and Compensation⌘
When is "Restore delegate name" activity executed?
Conversations⌘
Conversations⌘
- Conversation diagram it is a particular usage of a Collaboration diagram.
- A Conversation is a logical grouping of Message exchanges that can share a Correlation (a business object of interest, e.g, “Order,” “Shipment and Delivery,” and “Invoice”)
- Processes can appear within the Participants (Pools) of Conversation diagrams, to show how Conversation and Activities are related.
Conversation elements⌘
Conversation Example 1⌘
Conversation Example 2⌘
Choreography⌘
Choreography⌘
- A Choreography defines the sequence of interactions between Participants (Pools).
- Choreographies exist outside of or in between Pools.
- Choreography does not exist in a single Pool. Each step in the Choreography involves two or more Participants.
- A Choreography can't be directly executed.
- A Choreography does not have a central control mechanism.
Choreography Example 1⌘
Choreography Task⌘
- A Choreography Task is an atomic Activity in a Choreography Process.
- It represents an Interaction, which is one or two Message exchanges between two Participants.
Choreography Task with a Message⌘
Two-way Choreography Task⌘
Sequence Flow⌘
Gateways⌘
- Interactions between Participants can happen in sequence, in parallel, or through exclusive selection.
- Exclusive, Inclusive, Parallel, Event-based and Complex Gateways can be used with some constraints (because the lack of a central mechanism to maintain data visibility, and no central evaluation)
Exclusive Gateway Example⌘
Choreography Example 2 from spec⌘
Business Process Model and Notation (BPMN), Version 2.0, pages 318-319
Choreography Example 2 from spec⌘
Execution Semantics⌘
- BPMN Execution Semantics (BPMN 2.0 spec, Chapter 13) describes how BPMN elements should be executed on an engine.
- Not all elements can be executed. Non-operational elements like Manual Task, Abstract Task, DataState, Ad-Hoc Process can be ignored.
Token⌘
- A token is a theoretical concept that is used as an aid to define the behavior of a Process that is being performed.
- The behavior of Process elements can be defined by describing how they interact with a token as it “traverses” the structure of the Process.
- However, modeling and execution tools that implement BPMN are NOT REQUIRED to implement any form of token.
Sequence Flow⌘
- Multiple outgoing Sequence Flows with conditions behaves as an inclusive split.
- A mix of multiple outgoing Sequence Flows with and without conditions is considered as a combination of a parallel and an inclusive split
Exclusive Gateway⌘
- Each token arriving at any incoming Sequence Flows activates the gateway and is routed to exactly one of the outgoing Sequence Flows.
- If and only if none of the conditions evaluates to true, the token is passed on the default Sequence Flow.
- In case all conditions evaluate to false and a default flow has not been specified, an exception is thrown.
Parallel Gateway⌘
- The Parallel Gateway is activated if there is at least one token on each incoming Sequence Flow.
- The Parallel Gateway consumes exactly one token from each incoming Sequence Flow and produces exactly one token at each outgoing Sequence Flow.
- If there are excess tokens at an incoming Sequence Flow, these tokens remain at this Sequence Flow after execution of the Gateway.
- The Parallel Gateway cannot throw any exception.
Diagram Interchange⌘
- In order to avoid recreating processes for tools from different vendors, it's important to have a standard format for exchanging BPMN processes.
- In BPMN 2.0 processes can be described using two aspects:
- processes models contain the semantics
- processes diagrams store visual representation of the process models
Process model contains complete definition of processes, process diagram describes an incomplete or partial representation (view) of this model.
BPMN 2.0 XML⌘
- BPMN 2.0 file is an executable XML representation of a business process
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition" ... >
<process processType="Private" isExecutable="true" id="com.sample.bpmn.hello" name="Hello World" >
<!-- nodes -->
<scriptTask id="_2" name="Hello" >
<script>System.out.println("Hello World");</script>
</scriptTask>
<startEvent id="_1" />
<endEvent id="_3" >
<terminateEventDefinition/>
</endEvent>
<!-- connections -->
<sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
</process>
BPMN 2.0 XML⌘
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="com.sample.bpmn.hello" >
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="96" y="16" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="30" y="22" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="210" y="22" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_1-_2" >
<di:waypoint x="66" y="40" />
<di:waypoint x="96" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_3" >
<di:waypoint x="176" y="40" />
<di:waypoint x="210" y="40" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
BPMN 2.0 XML⌘
- BPMN 2.0 defines standarized formats for creating XML files which contains both aspects.
- This allows exchanging BPMN processes between tools of different vendors.
- XML BPMN files contain two parts:
- one or more process models
- one or more process diagrams
- BPMN 2.0 processes can be stored using formats defined by XMI or XSD.
Interchange Capabilities⌘
From a user point of view, BPMN diagram interchange capable tools should allow:
- exporting processes to XML file
- importing processes from XML files
in such way that the model content and layout are preserved - there is no need to re-draw processes manually.
Interchange Limitations⌘
BPMN Diagram Interchange provides no mechanism for:
- colors of shapes and text
- decoration of shapes (shadows, gradients, backgrounds)
- text fonts and size
- text wrapping
- thickness and style of lines
Interchanging Incomplete Models⌘
- In practice, it is common for models to be interchanged before they are complete.
- The importing tool is expected to be able to open exported incomplete diagrams.
Module 2. Questions⌘
- What is complex gateway?
- How many different types of loops are there in BPMN?
- How can you trigger a compensation?
- What is Conversation, Choreography?
- What is an Execution Semantics?
- What is the difference between process model and process diagram?






























