Skip to content

Instantly share code, notes, and snippets.

View berndruecker's full-sized avatar

Bernd Ruecker berndruecker

View GitHub Profile
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@ZeebeSpringTest
public class TestCustomerOnboardingProcess {
// ...
@Test
public void testAutomaticOnboarding() throws Exception {
// Define expectations on the REST calls
// 1. http://localhost:8080/crm/customer
mockRestServer
.expect(requestTo("http://localhost:8080/crm/customer")) //
@berndruecker
berndruecker / pom.xml
Created November 16, 2023 09:41
Adding Camunda client in Maven
<dependency>
<groupId>io.camunda</groupId>
<artifactId>spring-zeebe-starter</artifactId>
<version>${camunda.version}</version>
</dependency>
@berndruecker
berndruecker / Worker.java
Last active October 24, 2023 08:38
Worker.java
public class FetchGoodsWorker {
@Worker(type = "fetchGoods")
public void fetchGoods(final ActivatedJob job) {
// your code goes here, you can access variables from the process via
// job.getVariables();
}
}
@JobWorker(type = "foo")
public void handleJobFoo(final ActivatedJob job) {
myDatabaseRepository.save( createNewEntityForSomeReason(job) );
}
# Values for Camunda Platform helm on OpenShift.
# Merged from default values and OpenShift specific ones.
# Also contains some specifics for the installation system, like web endpoints
# This is a YAML-formatted file.
# The values file follows helm best practices https://helm.sh/docs/chart_best_practices/values/
#
# This means:
# * Variable names should begin with a lowercase letter, and words should be separated with camelcase.
// Part of the runtime that provides webhook endpoints
@PostMapping("/inbound/{context}")
public ResponseEntity<ProcessInstanceEvent> inbound(
@PathVariable String context,
@RequestBody Map<String, Object> body,
@RequestHeader Map<String, String> headers) {
if (!registry.containsContextPath(context)) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No webhook found for context: " + context);
}
@Scheduled(fixedDelay = 5000)
public void scheduleImport() throws OperateException {
List<ProcessDefinition> processDefinitions = camundaOperateClient
.searchProcessDefinitions();
for (ProcessDefinition processDefinition: processDefinitions) {
if (!registry.processDefinitionChecked(processDefinition.getKey())) {
processBpmnXml(
processDefinition,
camundaOperateClient.getProcessDefinitionXml(processDefinition.getKey()));
registry.markProcessDefinitionChecked(processDefinition.getKey());
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0szphh0" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.3.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.0.0">
<bpmn:process id="benchmark-dmn" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1kedjft</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1kedjft" sourceRef="StartEvent_1" targetRef="task10" />
<bpmn:endEvent id="Event_1hr99hk">
<bpmn:incoming>Flow_147jeh7</bpmn:incoming>
</bpmn:endEvent>
@berndruecker
berndruecker / bpmn-for-dmn-benchmark.bpmn
Created October 10, 2022 15:18
Process model calling DMN decision in a MI
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0szphh0" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.3.0" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.0.0">
<bpmn:process id="benchmark-dmn" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1kedjft</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1kedjft" sourceRef="StartEvent_1" targetRef="Activity_0kgk5zd" />
<bpmn:endEvent id="Event_1hr99hk">
<bpmn:incoming>Flow_147jeh7</bpmn:incoming>
</bpmn:endEvent>
@berndruecker
berndruecker / data.json
Created October 10, 2022 14:45
Sample data to run 2000 MIs
{
"var1": "value1",
"var2": true,
"var3": 15,
"var4": {
"var4-1": "value4-1",
"var4-2": false,
"var4-3": 111
},
"var5": "736d9100-0155-4af5-be14-b09c42de8417",