Hi,
I am trying to setup a heterogeneous cluster with the community edition. Before I setup a kubernetes cluster I was trying to test this functionality with two local JAVA applications.
At the beginning I create a JAVA project using https://start.camunda.com.
- Group: com.myapplication.camunda.webapps
- Artifact: application
- Camunda Platform Version: 7.15.0
- Spring Boot Version: 2.4.3
- H2 Database: On-Disk (will be replaced later with MySQL)
- Java Version: 11
- Camund Platform Modules: REST API, Webapps, Spin (XML & JSON)
- Spring Boot Modules: nothing
I extract the zip file and open it in IntelliJ. After that I do the following steps:
- Change the JDK to openJDK 16
- Create a JAVA class com.myapplication.camunda.webapps.worker.GetNumber (implements JavaDelegate) with the following function:
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
delegateExecution.setVariable("value", 12);
}
- Replace the H2 dpendency in the pom.xml with the following:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</dependency>
- Change the database settings in the application.yaml
spring:
datasource:
url: jdbc:mysql://localhost:3306/camunda?sendFractionalSeconds=false
username: camunda
password: Secret-Passw0rd
driver-class-name: com.mysql.cj.jdbc.Driver
camunda.bpm.admin-user:
id: demo
password: demo
- Modify the bpmn file to the following structure:
start → user task → service task (JAVA class → com.myapplication.camunda.webapps.worker.GetNumber) → user task → end
When I start the application, everything works. I can open http://localhost:8080, open task list, start a new process confirm the first user task, and when I open the last user task, I see the “value = 12”.
So far, so good.
Now I want to split the webapps from business logic and bpmn file.
I create a second application using http://start.camunda.com, but this time without the camunda webapps.
- Group: com.myapplication.camunda.logic
- Artifact: quiz
- Camunda Platform Version: 7.15.0
- Spring Boot Version: 2.4.3
- H2 Database: On-Disk (will be replaced later with MySQL)
- Java Version: 11
- Camund Platform Modules: REST API, Spin (XML & JSON)
- Spring Boot Modules: nothing
I change the SDK to openJDK 16 and the server.port to 8090 in the application.yaml. The database connection and pom dependency will be changed similar to the application project.
I copy the bpmn file and the worker.GetNumber class from the application project to the quiz project. After that I delete both files from the application project.
In the GetNumber class I change the returnin number from 12 to 13 (just to see if the correct class is called). I paste the new JAVA class reference to the bpm service task.
Now I start both applications and open the task tasklist on localhost:8080. I start a new process, claim and complete the task an I get an error message:
An error happened while submitting the task form : Cannot submit task form d620a29e-0e53-11ec-9f2c-1623875a5188: ENGINE-09008 Exception while instantiating class 'com.myapplication.camunda.logic.worker.GetNumber': ENGINE-09017 Cannot load class 'com.myapplication.camunda.logic.worker.GetNumber': com.myapplication.camunda.logic.worker.GetNumber
I know, that I have to set asynchronous before / after in the bpmn file, and I think I have to implement Tasklistener - somewhere.
I have already seen the youtube video from CamundaCon 2018, but I didn’t get it work with the current Camunda / openJDK version (CamundaCon 2018: Camunda In A Heterogeneous Cluster (Generali) - YouTube).
Can someone help me to get the quiz worker working?
Thanks in advance and best regards,
Rainer