Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/27 execution listener #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions camunda-7-adapter/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@ expression, e.g.:
</bpmn:serviceTask>
```

If you are using an expression, you might want to write the result to a process variable. This can be achieved by setting an additional `resultVariable` header:

```xml

<bpmn:serviceTask id="task3" name="Expression">
<bpmn:extensionElements>
<zeebe:taskDefinition type="camunda-7-adapter"/>
<zeebe:taskHeaders>
<zeebe:header key="expression" value="${someBean.awesomeMethod(execution, someVar)}"/>
<zeebe:header key="resultVariable" value="awesomeMethodResult"/>
</zeebe:taskHeaders>
</bpmn:extensionElements>
</bpmn:serviceTask>
Expand All @@ -102,6 +105,22 @@ The external task workers can be mapped by using the `taskType` and insert the
</bpmn:serviceTask>
```

## Using Execution listener

To use execution listeners, use the header `executionListener.start` or `executionListener.end`. The value should be of type `delegateExpression` which returns a bean of type `ExecutionListener`:

```xml

<bpmn:serviceTask id="task3" name="Expression">
<bpmn:extensionElements>
<zeebe:taskHeaders>
<zeebe:header key="executionListener.start" value="${startExecutionListenerBean}"/>
<zeebe:header key="executionListener.end" value="${endExecutionListenerBean}"/>
</zeebe:taskHeaders>
</bpmn:extensionElements>
</bpmn:serviceTask>
```

## Example

Check out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class SimpleVariableScope extends AbstractVariableScope {

private static final long serialVersionUID = 1L;

protected VariableInstanceFactory<CoreVariableInstance> variableInstanceFactory = (name, value, isTransient) -> new SimpleVariableInstance(name, value);
protected VariableStore<SimpleVariableInstance> variableStore =
new VariableStore<SimpleVariableInstance>();
protected VariableInstanceFactory<CoreVariableInstance> variableInstanceFactory =
(name, value, isTransient) -> new SimpleVariableInstance(name, value);
protected VariableStore<CoreVariableInstance> variableStore = new VariableStore<>();

public SimpleVariableScope() {
this(Collections.emptyMap());
Expand All @@ -30,7 +30,7 @@ public SimpleVariableScope(Map<String, ?> variables) {
}

protected VariableStore<CoreVariableInstance> getVariableStore() {
return (VariableStore) variableStore;
return variableStore;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ public void delegateToCamundaPlatformCode(final JobClient client, final Activate
final DelegateExecution execution = new ZeebeJobDelegateExecution(job);

try {
if (startListener == null
&& endListener == null
&& delegateClass == null
&& delegateExpression == null
&& expression == null) {
if (delegateClass == null && delegateExpression == null && expression == null) {
throw new RuntimeException(
"Either 'executionListener.start' or 'class' or 'delegateExpression' or 'expression' or executionListener.end must be specified in task headers for job :"
"Either 'class' or 'delegateExpression' or 'expression' must be specified in task headers for job :"
+ job);
}

Expand Down