Skip to content

Commit e0155e0

Browse files
committed
Added learning material from tutorial. Contents not changed yet and still reference tutorial
1 parent 2b7d80c commit e0155e0

38 files changed

+2643
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## BPMN Model
2+
3+
The DSF expects BPMN 2.0 for its process execution. This write-up covers the BPMN elements
4+
most commonly used in DSF process plugins.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Conditions
2+
3+
[Conditions](https://docs.camunda.org/manual/7.20/user-guide/process-engine/expression-language/#conditions)
4+
allow you to change the behaviour of BPMN processes during execution. There are two ways you
5+
are able to add decision logic to Conditions. The [Camunda Modeler](https://camunda.com/download/modeler/) refers to them as `Type`. You can find them in the ``Condition`` tab of
6+
certain BPMN elements. The first one is `Script`. This allows you to add arbitrary complexity
7+
to your decisions logic and is rarely used for process plugins. The more common Type is `Expression`.
8+
Expressions have the following syntax: `${expression}`. For this tutorial, _expression_ will
9+
use a boolean condition like `var == true`. You can learn more advanced features of Expressions [here](https://docs.camunda.org/manual/7.20/user-guide/process-engine/expression-language/).
10+
For this to work during BPMN process execution, the variable you want to use for the boolean
11+
condition must be available in the BPMN process variables before [Sequence Flow](../../concepts/bpmn/sequence-flow.md)
12+
reaches the evaluation of the expression.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Gateways
2+
3+
[Gateways](https://docs.camunda.org/manual/7.20/reference/bpmn20/gateways/) allow you to control the [Sequence Flow](../../concepts/bpmn/sequence-flow.md). Different
4+
types of gateways will be useful for different scenarios.
5+
6+
#### Exclusive Gateways
7+
8+
[Exclusive Gateways](https://docs.camunda.org/manual/7.20/reference/bpmn20/gateways/exclusive-gateway/)
9+
allow you to decide which [Sequence Flow](../../concepts/bpmn/sequence-flow.md) should be followed based on [conditions](https://docs.camunda.org/manual/7.20/user-guide/process-engine/expression-language/#conditions).
10+
[Conditions](https://docs.camunda.org/manual/7.20/user-guide/process-engine/expression-language/#conditions) are not part of the
11+
[Exclusive Gateways](https://docs.camunda.org/manual/7.20/reference/bpmn20/gateways/exclusive-gateway/) themselves. You set them
12+
through the sequence Flow Exiting the [Exclusive Gateway](https://docs.camunda.org/manual/7.20/reference/bpmn20/gateways/exclusive-gateway/).
13+
In the [Camunda Modeler](https://camunda.com/download/modeler/), you can add conditions to [Sequence Flow](../../concepts/bpmn/sequence-flow.md) by selecting
14+
a [Sequence Flow](../../concepts/bpmn/sequence-flow.md) and opening the `Condition` tab. You can find more information on how to
15+
use Conditions [here](../../concepts/bpmn/conditions.md).
16+
17+
#### Event-based Gateway
18+
19+
The [Event-based Gateway](https://docs.camunda.org/manual/7.20/reference/bpmn20/gateways/event-based-gateway/)
20+
allows you model scenarios where you are expecting one out of a number of events to occur.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### Messaging
2+
3+
In order to enable communication with other lanes, pools or even entirely separate processes you need to be able
4+
to exchange information. In BPMN, you can use [Message Events](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/)
5+
to model this information exchange. Modeling communication with [Message Events](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/) in the same diagram
6+
uses Message Flow. Message Flow is typically represented by a dashed line arrow between BPMN elements with a black (send) or white (receive) envelope icon.
7+
The following BPMN collaboration diagram shows message exchange between two processes.
8+
9+
<picture>
10+
<source media="(prefers-color-scheme: dark)" srcset="figures/exercise3_message_flow_inverted.svg">
11+
<source media="(prefers-color-scheme: light)" srcset="figures/exercise3_message_flow.svg">
12+
<img alt="BPMN collaboration diagram with two processes using message flow to exchange information between two organizations" src="figures/exercise3_message_flow.svg">
13+
</picture>
14+
15+
#### Message Start Event
16+
17+
[Message Start Events](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/#message-start-event)
18+
allow a BPMN process to be started by an incoming message. In the DSF, all BPMN processes are started via messages. Therefore,
19+
you will have to include a [Message Start Event](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/#message-start-event) at
20+
the beginning of all of your BPMN models.
21+
22+
#### Message Intermediate Throwing Event
23+
[Message Intermediate Throwing Events](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/#message-intermediate-throwing-event)
24+
are used to send messages during process execution.
25+
26+
#### Message Intermediate Catching Event
27+
[Message Intermediate Catching Events](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/#message-intermediate-catching-event) serve as
28+
the counterpart to [Message Intermediate Throwing Events](messaging.md#message-intermediate-throwing-event).
29+
Use them whenever you expect to receive a message from another process or organization during execution.
30+
31+
#### Message End Event
32+
The [Message End Event](https://docs.camunda.org/manual/7.20/reference/bpmn20/events/message-events/#message-end-event) will
33+
stop the execution of a BPMN process and finish by sending a message.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Sequence Flow
2+
BPMN 2.0 calls the continuous arrows connecting the BPMN elements in BPMN models, Sequence Flow.
3+
Sequence Flow exits one BPMN element and points at the next BPMN element to be processed.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Service Tasks
2+
3+
You will primarily use [Service Tasks](https://docs.camunda.org/manual/7.20/reference/bpmn20/tasks/service-task/)
4+
when creating BPMN models. They are different from regular BPMN Tasks in that they offer the ability to
5+
link an implementation to the [Service Task](https://docs.camunda.org/manual/7.20/reference/bpmn20/tasks/service-task/)
6+
which can be called and executed by a BPMN engine. The BPE (Business Process Engine) server of the DSF leverages
7+
this engine to execute your BPMN processes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Timer Intermediate Catching Events
2+
3+
A [Timer Intermediate Catching Event](https://docs.camunda.org/manual/7.17/reference/bpmn20/events/timer-events/#timer-intermediate-catching-event)
4+
allows you model stopwatch behavior. A timer is started once the BPMN execution arrives at the event.
5+
The duration until the timer runs out is specified using the [ISO 8601 Durations](http://en.wikipedia.org/wiki/ISO_8601#Durations) format.
6+
Examples can be found [here](https://docs.camunda.org/manual/7.17/reference/bpmn20/events/timer-events/#time-duration). After running out, the BPMN process executes the [Sequence Flow](../../concepts/bpmn/sequence-flow.md) following
7+
the [Timer Intermediate Catching Event](https://docs.camunda.org/manual/7.17/reference/bpmn20/events/timer-events/#timer-intermediate-catching-event).
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
### About Versions, Placeholders and URLs
2+
3+
#### Version Pattern
4+
5+
Process plugin versions have to obey the pattern:
6+
```
7+
\d+\.\d+\.\d+\.\d+ Example: 1.0.1.2
8+
```
9+
10+
The first two numbers (`1.0`) are used in FHIR resources and signal changes which break compatibility with previous
11+
process versions. For example, altering FHIR resources usually results in a breaking change. The latter two (`1.2`) signal changes which do not break compatibility with previous process versions. Specifically,
12+
the 4th number is reserved for bug-fixes and the 3rd number includes all other non-breaking changes.
13+
14+
#### Placeholders
15+
16+
To avoid the need to specify the version and release date for each [ActivityDefinition](../../concepts/fhir/activitydefinition.md), [CodeSystem](../../concepts/fhir/codesystem.md),
17+
[Task](../../concepts/fhir/task.md) profile and [ValueSet](../../concepts/fhir/valueset.md) resource,
18+
the placeholders `#{version}` and `#{date}` can be used when creating FHIR resources or even in BPMN models.
19+
They are replaced with the values returned by the methods `ProcessPluginDefinition#getResourceVersion`
20+
and `ProcessPluginDefinition#getReleaseDate` respectively during deployment of a process plugin by the DSF BPE server.
21+
There is also a placeholder for the organization the DSF instance is running in: `#{organization}`. You would typically use
22+
this placeholder in [Draft Task Resources](draft-task-resources.md) but like the other placeholders, it can be used anywhere
23+
as long as the file gets loaded by the [BPE](https://dsf.dev/intro/info/architecture.html#business-process-engine-bpe).
24+
25+
#### URLs
26+
27+
BPMN models have an ID we call process definition key. The BPMN process definition key needs to be specified following the pattern:
28+
```
29+
^[-a-zA-Z0-9]+_[-a-zA-Z0-9]+$ Example: domainorg_processKey
30+
```
31+
In addition, the BPMN model needs to specify a version. You should be using the ``#{version}`` [placeholder](../../concepts/dsf/about-version-placeholders-and-urls.md#placeholders)
32+
for this as well. The DSF will also reference this process in URL form in FHIR resources:
33+
```
34+
http://domain.org/bpe/Process/processKey|1.0
35+
```
36+
37+
As you can see, the version in the URL ``|1.0`` only uses the resource version and omits the code base version.
38+
As mentioned in [Version Pattern](about-version-placeholders-and-urls.md#version-pattern), this means that only changes to the first two
39+
version numbers are significant to signal compatibility when communicating with other process plugin instances.
40+
The process definition key and URL are also related to each other. The DSF will try to match BPMN models
41+
to FHIR resources by transforming the URL into a process definition key. That is why it is important you obey
42+
the pattern above.
43+
44+
You will use the above URL as your instantiatesCanonical value for [Task](../../concepts/fhir/task.md) profile definitions as well as references
45+
to [Task](../../concepts/fhir/task.md) profiles in other resources.
46+
You will also use it as the URL value for your [ActivityDefinitions](../../concepts/fhir/activitydefinition.md). In this case though, you
47+
have to split up the URL into two parts. You will separate the version (``|1.0``) from the URL and use it as a value for the
48+
`ActivityDefinition.version` element. Since it refers to the plugin's resource version, you should also use the `#{version}`
49+
[placeholder](about-version-placeholders-and-urls.md#placeholders) here instead. Going by the example from above, you will be left with a URL that looks
50+
like this:
51+
```
52+
http://domain.org/bpe/Process/processKey
53+
```
54+
This will be the value for your `ActivityDefinition.url` element with `#{version}` as the value for your `ActivityDefinition.version` element.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### BPMN Process Execution
2+
3+
The BPMN process execution is the in-memory representation of a running BPMN process. BPMN processes have their
4+
executions structured as a tree hierarchy. Each BPMN process
5+
starts with the [process instance](https://docs.camunda.org/manual/7.20/user-guide/process-engine/process-engine-concepts/#process-instances)
6+
as its root level execution. If, for example, this root execution reaches a parallel gateway with two paths, it would spawn two child executions
7+
under itself for them to process all tasks along their paths on their own.
8+
Executions can access all the BPMN elements from the BPMN model as well as the [BPMN process variables](../../concepts/dsf/bpmn-process-variables.md).
9+
You have access to this representation in your Java code when overriding certain methods in [Service](../../concepts/dsf/service-delegates.md) / [Message](../../concepts/dsf/message-delegates.md) Delegates
10+
like `doExecute` or `getAdditionalInputParameters` through the `execution` parameter.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### BPMN Process Variables
2+
3+
BPMN process variables hold additional information which has to be available during BPMN process execution.
4+
Variables can be directly related to BPMN elements like the boolean value for [Conditions](../../concepts/bpmn/conditions.md), but
5+
do not have to be. BPMN process variables are stored as key-value pairs with the key being the variable name.
6+
They are accessible during the entirety of the execution to all [Service](../../concepts/dsf/service-delegates.md) /
7+
[Message](../../concepts/dsf/message-delegates.md) Delegates.
8+
9+
You can learn how to access to the BPMN process variables [here](../../guides/accessing-bpmn-process-variables.md).

0 commit comments

Comments
 (0)