Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Camunda License 1.0. You may not use this file
* except in compliance with the Camunda License 1.0.
*/
package org.camunda.conversion.execution_listeners;

import java.util.Map;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ExecutionListenerTestController {

private final RuntimeService runtimeService;

public ExecutionListenerTestController(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}

/**
* Start the execution-listener-test process with variable "foo".
*
* Usage: curl -X POST "http://localhost:8080/test/execution-listener?foo=bar"
*/
@PostMapping("/test/execution-listener")
public String startProcess(@RequestParam(name = "foo", defaultValue = "bar") String foo) {
ProcessInstance pi = runtimeService.startProcessInstanceByKey(
"execution-listener-test",
Map.of("foo", foo)
);
return "Started process instance: " + pi.getId() + " with foo=" + foo;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Camunda License 1.0. You may not use this file
* except in compliance with the Camunda License 1.0.
*/
package org.camunda.conversion.execution_listeners;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class MyExecutionListener implements ExecutionListener {

private static final Logger LOG = LoggerFactory.getLogger(MyExecutionListener.class);

@Override
public void notify(DelegateExecution execution) {
String someVar = (String) execution.getVariable("foo");
LOG.info(">>> ExecutionListener triggered! foo = {}", someVar);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Map;

@Configuration
@ExternalTaskSubscription("retrievePaymentAdapter")
@ExternalTaskSubscription("retrievePaymentAdapterBpmnErrorJavaObjectAPI")
public class RetrievePaymentWorkerBPMNErrorJavaObjectAPI implements ExternalTaskHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.springframework.context.annotation.Configuration;

@Configuration
@ExternalTaskSubscription("retrievePaymentAdapter")
@ExternalTaskSubscription("retrievePaymentAdapterBpmnErrorTypedValueAPI")
public class RetrievePaymentWorkerBPMNErrorTypedValueAPI implements ExternalTaskHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Map;

@Configuration
@ExternalTaskSubscription("retrievePaymentAdapter")
@ExternalTaskSubscription("retrievePaymentAdapterFailure")
public class RetrievePaymentWorkerFailure implements ExternalTaskHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Map;

@Configuration
@ExternalTaskSubscription("retrievePaymentAdapter")
@ExternalTaskSubscription("retrievePaymentAdapterIncident")
public class RetrievePaymentWorkerIncident implements ExternalTaskHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Map;

@Configuration
@ExternalTaskSubscription("retrievePaymentAdapter")
@ExternalTaskSubscription("retrievePaymentAdapterProcessVarsJavaObjectAPI")
public class RetrievePaymentWorkerProcessVariablesJavaObjectAPI implements ExternalTaskHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.springframework.context.annotation.Configuration;

@Configuration
@ExternalTaskSubscription("retrievePaymentAdapter")
@ExternalTaskSubscription("retrievePaymentAdapterProcessVarsTypedValueAPI")
public class RetrievePaymentWorkerProcessVariablesTypedValueAPI implements ExternalTaskHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ spring.datasource.url: jdbc:h2:file:./camunda-h2-database

camunda.bpm.admin-user:
id: demo
password: demo
password: demo

camunda.bpm.client:
base-url: http://localhost:8080/engine-rest
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
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:camunda="http://camunda.org/schema/1.0/bpmn"
id="Definitions_el_test"
targetNamespace="http://bpmn.io/schema/bpmn">

<bpmn:process id="execution-listener-test" name="Execution Listener Test" isExecutable="true" camunda:historyTimeToLive="180">

<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1</bpmn:outgoing>
</bpmn:startEvent>

<bpmn:sequenceFlow id="Flow_1" sourceRef="StartEvent_1" targetRef="ServiceTask_1" />

<bpmn:serviceTask id="ServiceTask_1" name="Task with Execution Listener" camunda:expression="${true}">
<bpmn:extensionElements>
<camunda:executionListener event="start" delegateExpression="${myExecutionListener}" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_1</bpmn:incoming>
<bpmn:outgoing>Flow_2</bpmn:outgoing>
</bpmn:serviceTask>

<bpmn:sequenceFlow id="Flow_2" sourceRef="ServiceTask_1" targetRef="EndEvent_1" />

<bpmn:endEvent id="EndEvent_1">
<bpmn:incoming>Flow_2</bpmn:incoming>
</bpmn:endEvent>

</bpmn:process>

<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="execution-listener-test">
<bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1_di" bpmnElement="ServiceTask_1">
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1_di" bpmnElement="EndEvent_1">
<dc:Bounds x="432" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1_di" bpmnElement="Flow_1">
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_2_di" bpmnElement="Flow_2">
<di:waypoint x="370" y="117" />
<di:waypoint x="432" y="117" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

This file was deleted.

Loading
Loading