- process
- start event
- exclusive gateway
- parallel gateway
- script task
- service task
- user task
- signal event definition
- end event
- subprocess
Create a Process With the Fluent Builder API
To create an empty model instance with a new process the methodBpmn.createProcess() is used. After this,
you can add as many tasks and gateways as you like. At the end you must call done() to return the generated
model instance. For example, a simple process with one user task can be created like this:
moveToLastGateway() method and you return to the last gateway and can model the next path.
condition() and give it a label and an expression.
moveToLastGateway() method but have multiple incoming
sequence flows at your current position, you have to use the generic
moveToNode method with the id of the gateway. This could for example happen
if you add a join gateway to your process. For this purpose and for loops, we
added the connectTo(elementId) method.
moveToNode is not
necessary, because at this point the joining gateway only has one incoming sequence
flow, but was used for consistency.
camundaIn methods, it is possible to define which process variables will be included in the signal payload, define an expression that will be resolved in the signal-catching process instances, or declare that all of the process variables in the signal-throwing process instance should be passed. It is also possible to define a business key that will be assigned to the signal-catching process instances.
Extend a Process With the Fluent Builder API
With the fluent builder API you can not only create processes, you can also extend existing processes. For example, imagine a process containing a parallel gateway with the idgateway. You now want to
add another execution path to it for a new service task which has to be executed every time.
task1 which is followed by a service task. And now
you want to add a script task and a user task between these two.
Common Model Patterns
Controlling Transaction Boundaries
The transaction boundaries of a process created with the fluent builder API can be controlled using thecamundaAsyncBefore() and camundaAsyncAfter() methods offered for various process constructs.
camundaAsyncBefore() and camundaAsyncAfter() methods apply to the multi-instance body as a whole. The transaction boundaries of the individual occurrences (instances) of the multi-instance can be controlled with similar methods, called from within the multi-instance builder.