JBoss.orgCommunity Documentation
The primary goal of BPMN is to provide a notation that is readily understandable by all business users, from the business analysts that create the initial drafts of the processes, to the technical developers responsible for implementing the technology that will perform those processes, and finally, to the business people who will manage and monitor those processes."
The Business Process Model and Notation (BPMN) 2.0 specification is an OMG specification that not only defines a standard on how to graphically represent a business process (like BPMN 1.x), but now also includes execution semantics for the elements defined, and an XML format on how to store (and share) process definitions.
jBPM5 allows you to execute processes defined using the BPMN 2.0 XML format. That means that you can all the different jBPM5 components to model, execute, manage and monitor your business processes using the BPMN 2.0 format for specifying your executable business processes. Actually, the full BPMN 2.0 specification also includes details on how to represent things like choreographies and and collaboration. The jBPM project however focuses on that part of the specification that can be used to specify executable processes.
jBPM5 does not implement all elements and attributes as defined in the BPMN 2.0 specification. We do however support a significant subset, including the most common node types that can be used inside executable processes. This includes (almost) all elements and attributes as defined in the "Common Executable" subclass of the BPMN 2.0 specification, extended with some additional elements and attributes we believe are valuable in that context as well. The full set of elements and attributes that are supported can be found below, but it includes elements like:
For example, consider the following "Hello World" BPMN 2.0 process, which does nothing more that writing out a "Hello World" statement when the process is started.
An executable version of this process expressed using BPMN 2.0 XML would look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.example.org/MinimalExample"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process processType="Private" isExecutable="true" id="com.sample.HelloWorld" name="Hello World" >
<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<scriptTask id="_2" name="Hello" >
<script>System.out.println("Hello World");</script>
</scriptTask>
<endEvent id="_3" name="EndProcess" >
<terminateEventDefinition/>
</endEvent>
<!-- connections -->
<sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="Minimal" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="15" y="91" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="95" y="88" width="83" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="258" y="86" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_1-_2" >
<di:waypoint x="39" y="115" />
<di:waypoint x="75" y="46" />
<di:waypoint x="136" y="112" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_3" >
<di:waypoint x="136" y="112" />
<di:waypoint x="240" y="240" />
<di:waypoint x="282" y="110" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
To create your own process using BPMN 2.0 format, you can
Create a new Flow file using the Drools Eclipse plugin wizard and in the last page of the wizard, make sure you select Drools 5.1 code compatibility. This will create a new process using the BPMN 2.0 XML format. Note however that this is not exactly a BPMN 2.0 editor, as it still uses different attributes names etc. It does however save the process using valid BPMN 2.0 syntax. Also note that the editor does not support all node types and attributes that are already supported in the execution engine.
Oryx is an open-source web-based editor that supports the BPMN 2.0 format. We have embedded it into Guvnor for BPMN 2.0 process visualization and editing. You could use the Oryx editor (either standalone or integrated) to create / edit BPMN 2.0 processes and then export them to BPMN 2.0 format or save them into Guvnor and import them so they can be executed.
A new BPMN2 Eclipse plugin is being created to support the full BPMN2 specification. It is currently still under development and only supports a limited number of constructs and attributes, but can already be used to create simple BPMN2 processes. To create a new BPMN2 file for this editor, use the wizard (under Examples) to create a new BPMN2 file, which will generate a .bpmn2 file and a .prd file containing the graphical information. Double-click the .prd file to edit the file using the graphical editor.
You can always manually create your BPMN 2.0 process files by writing the XML directly.
The following code fragment shows you how to load a BPMN2 process into your knowledge base ...
private static KnowledgeBase createKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn2"), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
... and how to execute this process ...
KnowledgeBase kbase = createKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.startProcess("com.sample.HelloWorld");
The BPMN 2.0 specification defines the attributes and semantics of each of the node types (and other elements).
The jbpm-bpmn2 module contains a lot of junit tests for each of the different node types. These test processes can also serve as simple examples: they don't really represent an entire real life business processes but can definitely be used to show how specific features can be used. For example, the following figures shows the flow chart of a few of those examples. The entire list can be found in the src/main/resources folder for the jbpm-bpmn2 module like here.
Table 4.1. Keywords
Element | Supported attributes | Supported elements | Extension attributes |
---|---|---|---|
definitions | rootElement BPMNDiagram | ||
process | processType isExecutable name id | property laneSet flowElement | packageName |
sequenceFlow | sourceRef targetRef isImmediate name id | conditionExpression | bendpoints |
interface | name id | operation | |
operation | name id | inMessageRef | |
laneSet | lane | ||
lane | name id | flowNodeRef | |
Events | |||
startEvent | name id | dataOutput dataOutputAssociation outputSet eventDefinition | x y width height |
endEvent | name id | dataInput dataInputAssociation inputSet eventDefinition | x y width height |
intermediateCatchEvent | name id | dataOutput dataOutputAssociation outputSet eventDefinition | x y width height |
intermediateThrowEvent | name id | dataInput dataInputAssociation inputSet eventDefinition | x y width height |
boundaryEvent | cancelActivity attachedToRef name id | eventDefinition | x y width height |
terminateEventDefinition | |||
cancelEventDefinition | |||
compensateEventDefinition | activityRef | documentation extensionElements | |
conditionalEventDefinition | condition | ||
errorEventDefinition | errorRef | ||
error | errorCode id | ||
escalationEventDefinition | escalationRef | ||
escalation | escalationCode id | ||
messageEventDefinition | messageRef | ||
message | itemRef id | ||
signalEventDefinition | signalRef | ||
timerEventDefinition | timeCycle | ||
Activities | |||
task | name id | ioSpecification dataInputAssociation dataOutputAssociation | taskName x y width height |
scriptTask | scriptFormat name id | script | x y width height |
script | text[mixed content] | ||
userTask | name id | ioSpecification dataInputAssociation dataOutputAssociation resourceRole | x y width height |
potentialOwner | resourceAssignmentExpression | ||
resourceAssignmentExpression | expression | ||
businessRuleTask | name id | x y width height ruleFlowGroup | |
manualTask | name id | x y width height | |
sendTask | messageRef name id | ioSpecification dataInputAssociation | x y width height |
receiveTask | messageRef name id | ioSpecification dataOutputAssociation | x y width height |
serviceTask | operationRef name id | ioSpecification dataInputAssociation dataOutputAssociation | x y width height |
subProcess | name id | flowElement property loopCharacteristics | x y width height |
adHocSubProcess | cancelRemainingInstances name id | completionCondition flowElement property | x y width height |
callActivity | calledElement name id | ioSpecification dataInputAssociation dataOutputAssociation | x y width height waitForCompletion independent |
multiInstanceLoopCharacteristics | loopDataInputRef inputDataItem | ||
Gateways | |||
parallelGateway | gatewayDirection name id | x y width height | |
eventBasedGateway | gatewayDirection name id | x y width height | |
exclusiveGateway | default gatewayDirection name id | x y width height | |
inclusiveGateway | default gatewayDirection name id | x y width height | |
Data | |||
property | itemSubjectRef id | ||
dataObject | itemSubjectRef id | ||
itemDefinition | structureRef id | ||
ioSpecification | dataInput dataOutput inputSet outputSet | ||
dataInput | name id | ||
dataInputAssociation | sourceRef targetRef assignment | ||
dataOutput | name id | ||
dataOutputAssociation | sourceRef targetRef assignment | ||
inputSet | dataInputRefs | ||
outputSet | dataOutputRefs | ||
assignment | from to | ||
formalExpression | language | text[mixed content] | |
BPMNDI | |||
BPMNDiagram | BPMNPlane | ||
BPMNPlane | bpmnElement | BPMNEdge BPMNShape | |
BPMNShape | bpmnElement | Bounds | |
BPMNEdge | bpmnElement | waypoint | |
Bounds | x y width height | ||
waypoint | x y |