Generator for Element Templates for Camunda Modeler from Job Workers using Spring Zeebe annotations.
Build using mvn clean install
.
Add the following dependency to your Spring Zeebe Maven project:
<dependency>
<groupId>org.camunda.community.extension.spring.zeebe.connector.template.generator</groupId>
<artifactId>spring-zeebe-connector-template-generator</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Add the generator to the component scan of your ProcessApplication
class:
@SpringBootApplication(
scanBasePackageClasses = {
ProcessApplication.class,
SpringZeebeConnectorTemplateGenerator.class
})
package org.example.camunda.process.solution.worker;
import io.camunda.zeebe.spring.client.annotation.JobWorker;
import io.camunda.zeebe.spring.client.annotation.Variable;
import org.example.camunda.process.solution.ProcessVariables;
import org.example.camunda.process.solution.service.MyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class MyWorker {
private static final Logger LOG = LoggerFactory.getLogger(MyWorker.class);
private final MyService myService;
public MyWorker(MyService myService) {
this.myService = myService;
}
@JobWorker
public ProcessVariables invokeMyService(@Variable String businessKey) {
LOG.info("Invoking myService with variables: " + businessKey);
boolean result = myService.myOperation(businessKey);
return new ProcessVariables()
.setResult(result); // new object to avoid sending unchanged variables
}
}
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"id": "invokeMyService",
"name": "invokeMyService",
"appliesTo": [
"bpmn:Task"
],
"elementType": {
"value": "bpmn:ServiceTask"
},
"properties": [
{
"type": "Hidden",
"value": "invokeMyService",
"binding": {
"type": "zeebe:taskDefinition:type"
}
}
,
{
"label": "businessKey",
"description": "businessKey",
"value": "=businessKey",
"type": "String",
"feel": "optional",
"binding": {
"type": "zeebe:input",
"name": "businessKey"
},
"constraints": {
"notEmpty": true
}
}
]
}
- Add contribution guide to the repo ( e.g. Contributing to this project )