Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: camunda 7 worker retries #241

Merged
merged 3 commits into from
Nov 30, 2023
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
Expand Up @@ -66,11 +66,15 @@ public void execute(final WorkerExecutor executor, final ExternalTask externalTa
* @return The remaining number of retries for the task.
*/
private int getRemainingRetries(Integer externalTaskRetries, Integer workerRetries) {
int retries = 0;
if (Objects.isNull(externalTaskRetries)) {
return Objects.isNull(workerRetries) ?
retries = Objects.isNull(workerRetries) ?
camunda7WorkerProperties.getDefaultRetries() :
workerRetries;
}else {
retries = externalTaskRetries;
}
return externalTaskRetries;
retries -= 1;
return Math.max(retries, 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void givenDefaultUseCaseAndRetriesProvided_thenInvokeGetRemainingRetries() throw

var retriesCaptor = ArgumentCaptor.forClass(Integer.class);
then(service).should().handleFailure((ExternalTask) any(), any(), any(), retriesCaptor.capture(), anyLong());
assertEquals(3, retriesCaptor.getValue());
assertEquals(3-1, retriesCaptor.getValue());
}

@Test
Expand All @@ -101,7 +101,7 @@ void givenDefaultUseCaseAndRetriesSetInBpmn_thenUseBpmnRetries() {

adapter.execute(defaultWorker, externalTask, service);

then(service).should().handleFailure((ExternalTask) any(), any(), any(), eq(bpmnRetries), anyLong());
then(service).should().handleFailure((ExternalTask) any(), any(), any(), eq(bpmnRetries-1), anyLong());
}

@Test
Expand All @@ -117,7 +117,7 @@ void givenDefaultUseCaseAndRetriesSetInWorkerInput_thenUseWorkerRetries() {

adapter.execute(defaultWorker, externalTask, service);

then(service).should().handleFailure((ExternalTask) any(), any(), any(), eq(workerRetries), anyLong());
then(service).should().handleFailure((ExternalTask) any(), any(), any(), eq(workerRetries-1), anyLong());
}

@Test
Expand All @@ -131,7 +131,7 @@ void givenDefaultUseCaseAndNoRetriesProvided_thenUseDefaultRetries() {

adapter.execute(defaultWorker, externalTask, service);

then(service).should().handleFailure((ExternalTask) any(), any(), any(), eq(defaultRetries), anyLong());
then(service).should().handleFailure((ExternalTask) any(), any(), any(), eq(defaultRetries-1), anyLong());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
server.port=9090
camunda.bpm.client.base-url=http://localhost:8080/engine-rest
camunda.bpm.client.disable-backoff-strategy=true
camunda.autoDeploy.enabled=false
#logging.level.root=DEBUG
#miranum.c7.auth.server.url=http://localhost:8080/auth/realms/forms-flow-ai/protocol/openid-connect/token
#miranum.c7.client.id=test-client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1dolndx" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.8.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="SimpleExampleProcess" name="Simple Example Process" isExecutable="true">
<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1dolndx" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.15.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="SimpleExampleProcess" name="Simple Example Process" isExecutable="true" camunda:historyTimeToLive="10">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0yx0bta</bpmn:outgoing>
</bpmn:startEvent>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<url>https://github.com/flowsquad/miranum-connect</url>

<properties>
<revision>0.4.0-SNAPSHOT</revision>
<revision>0.5.0-SNAPSHOT</revision>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<apache.commons.lang.version>3.13.0</apache.commons.lang.version>
Expand Down
5 changes: 3 additions & 2 deletions stack/camunda-7/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Use this only in dev environments. It's not intended for production usage.
version: '3'
services:
camunda:
image: camunda/camunda-bpm-platform:7.18.0
camunda-miranum:
image: camunda/camunda-bpm-platform:7.20.0
container_name: camunda-miranum
ports:
- "8080:8080"
Loading