Merge pull request #13093 from hmdrzsharifi/BAEL-5948

Bael 5948: Running Spring Boot Application with Embedded Camunda Engine
This commit is contained in:
davidmartinezbarua 2022-12-04 13:13:02 -03:00 committed by GitHub
commit bb57868ec9
7 changed files with 163 additions and 0 deletions

View File

@ -50,6 +50,7 @@
<module>spring-boot-keycloak-2</module>
<module>spring-boot-libraries</module>
<module>spring-boot-libraries-2</module>
<module>spring-boot-process-automation</module>
<module>spring-boot-logging-log4j2</module>
<module>spring-boot-mvc</module>
<module>spring-boot-mvc-2</module>

View File

@ -0,0 +1,5 @@
/target/
.settings/
.classpath
.project

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-process-automation</artifactId>
<parent>
<artifactId>spring-boot-modules</artifactId>
<groupId>com.baeldung.spring-boot-modules</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<version>${camunda.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<properties>
<camunda.version>7.18.0</camunda.version>
</properties>
</project>

View File

@ -0,0 +1,13 @@
package com.baeldung.camunda;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CamundaApplication {
public static void main(String[] args) {
SpringApplication.run(CamundaApplication.class, args);
}
}

View File

@ -0,0 +1,19 @@
package com.baeldung.camunda.task;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class CalculateInterestService implements JavaDelegate {
private static final Logger LOGGER = LoggerFactory.getLogger(CalculateInterestService.class);
@Override
public void execute(DelegateExecution execution) {
LOGGER.info("calculating interest of the loan");
}
}

View File

@ -0,0 +1,5 @@
spring.datasource.url: jdbc:h2:file:./camunda-h2-database
camunda.bpm.admin-user:
id: demo
password: demo

View File

@ -0,0 +1,67 @@
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.3.0">
<bpmn:process id="loanRequest" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_14bdz4q</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_14bdz4q" sourceRef="StartEvent_1" targetRef="ServiceTask_1tvk8uj" />
<bpmn:endEvent id="EndEvent_1y4bj2w">
<bpmn:incoming>SequenceFlow_1s49wir</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0d726xt" sourceRef="ServiceTask_1tvk8uj" targetRef="UserTask_0eay4mh" />
<bpmn:sequenceFlow id="SequenceFlow_1s49wir" sourceRef="UserTask_0eay4mh" targetRef="EndEvent_1y4bj2w" />
<bpmn:userTask id="UserTask_0eay4mh" name="Approve Loan">
<bpmn:incoming>SequenceFlow_0d726xt</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1s49wir</bpmn:outgoing>
</bpmn:userTask>
<bpmn:serviceTask id="ServiceTask_1tvk8uj" name="Calculate Interest" camunda:delegateExpression="${calculateInterestService}">
<bpmn:incoming>SequenceFlow_14bdz4q</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0d726xt</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="loanRequest">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="173" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="156" y="138" width="70" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1y4bj2w_di" bpmnElement="EndEvent_1y4bj2w">
<dc:Bounds x="625" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="606" y="138" width="75" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1tvk8uj_di" bpmnElement="ServiceTask_1tvk8uj">
<dc:Bounds x="275" y="80" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_0eay4mh_di" bpmnElement="UserTask_0eay4mh">
<dc:Bounds x="453" y="80" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_14bdz4q_di" bpmnElement="SequenceFlow_14bdz4q">
<di:waypoint x="209" y="120" />
<di:waypoint x="275" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="197" y="95" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0d726xt_di" bpmnElement="SequenceFlow_0d726xt">
<di:waypoint x="375" y="120" />
<di:waypoint x="453" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="366" y="95" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1s49wir_di" bpmnElement="SequenceFlow_1s49wir">
<di:waypoint x="553" y="120" />
<di:waypoint x="625" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="544" y="95" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>