Skip to content

Commit 9f603b5

Browse files
build(deps): bump zeebe.version from 8.4.1 to 8.4.3 (#642)
* build(deps): bump zeebe.version from 8.4.1 to 8.4.3 Bumps `zeebe.version` from 8.4.1 to 8.4.3. Updates `io.camunda:zeebe-bom` from 8.4.1 to 8.4.3 - [Release notes](https://github.com/camunda/zeebe/releases) - [Commits](camunda/camunda@8.4.1...8.4.3) Updates `io.camunda:zeebe-bpmn-model` from 8.4.1 to 8.4.3 - [Release notes](https://github.com/camunda/zeebe/releases) - [Commits](camunda/camunda@8.4.1...8.4.3) Updates `io.camunda:zeebe-process-test-extension` from 8.4.1 to 8.4.3 - [Commits](https://github.com/camunda-community-hub/zeebe-process-test-root/commits) Updates `io.camunda:zeebe-process-test-extension-testcontainer` from 8.4.1 to 8.4.3 - [Commits](https://github.com/camunda-community-hub/zeebe-process-test-root/commits) --- updated-dependencies: - dependency-name: io.camunda:zeebe-bom dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.camunda:zeebe-bpmn-model dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.camunda:zeebe-process-test-extension dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.camunda:zeebe-process-test-extension-testcontainer dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fixed a bug where the annotation was not handled properly * added a test to assert on the bug fix --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonathan Lukas <jonathan.lukas@camunda.com>
1 parent 842b0c8 commit 9f603b5

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<maven.compiler.source>${java.version}</maven.compiler.source>
2020
<maven.compiler.target>${java.version}</maven.compiler.target>
2121

22-
<zeebe.version>8.4.1</zeebe.version>
22+
<zeebe.version>8.4.3</zeebe.version>
2323
<identity.version>8.4.0-SNAPSHOT</identity.version>
2424

2525
<spring-boot.version>3.2.2</spring-boot.version>

spring-boot-starter-camunda/src/main/java/io/camunda/zeebe/spring/client/properties/PropertyBasedZeebeWorkerValueCustomizer.java

+20-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.apache.commons.lang3.StringUtils.*;
44

5+
import io.camunda.zeebe.client.api.response.ActivatedJob;
56
import io.camunda.zeebe.spring.client.annotation.Variable;
67
import io.camunda.zeebe.spring.client.annotation.VariablesAsType;
78
import io.camunda.zeebe.spring.client.annotation.ZeebeVariable;
@@ -44,7 +45,11 @@ public void customize(ZeebeWorkerValue zeebeWorker) {
4445
}
4546

4647
private void applyFetchVariables(ZeebeWorkerValue zeebeWorkerValue) {
47-
if (zeebeWorkerValue.isForceFetchAllVariables()) {
48+
if (hasActivatedJobInjected(zeebeWorkerValue)) {
49+
LOG.debug(
50+
"Worker '{}': ActivatedJob is injected, no variable filtering possible",
51+
zeebeWorkerValue.getName());
52+
} else if (zeebeWorkerValue.isForceFetchAllVariables()) {
4853
LOG.debug("Worker '{}': Force fetch all variables is enabled", zeebeWorkerValue.getName());
4954
zeebeWorkerValue.setFetchVariables(new String[0]);
5055
} else {
@@ -54,7 +59,7 @@ private void applyFetchVariables(ZeebeWorkerValue zeebeWorkerValue) {
5459
}
5560
variables.addAll(
5661
readZeebeVariableParameters(zeebeWorkerValue.getMethodInfo()).stream()
57-
.map(ParameterInfo::getParameterName)
62+
.map(this::extractVariableName)
5863
.collect(Collectors.toList()));
5964
variables.addAll(readVariablesAsTypeParameters(zeebeWorkerValue.getMethodInfo()));
6065
zeebeWorkerValue.setFetchVariables(variables.toArray(new String[0]));
@@ -65,12 +70,25 @@ private void applyFetchVariables(ZeebeWorkerValue zeebeWorkerValue) {
6570
}
6671
}
6772

73+
private boolean hasActivatedJobInjected(ZeebeWorkerValue zeebeWorkerValue) {
74+
return zeebeWorkerValue.getMethodInfo().getParameters().stream()
75+
.anyMatch(p -> p.getParameterInfo().getType().isAssignableFrom(ActivatedJob.class));
76+
}
77+
6878
private List<ParameterInfo> readZeebeVariableParameters(MethodInfo methodInfo) {
6979
List<ParameterInfo> result = methodInfo.getParametersFilteredByAnnotation(Variable.class);
7080
result.addAll(methodInfo.getParametersFilteredByAnnotation(ZeebeVariable.class));
7181
return result;
7282
}
7383

84+
private String extractVariableName(ParameterInfo parameterInfo) {
85+
Variable variableAnnotation = parameterInfo.getParameterInfo().getAnnotation(Variable.class);
86+
if (variableAnnotation != null && !Variable.DEFAULT_NAME.equals(variableAnnotation.name())) {
87+
return variableAnnotation.name();
88+
}
89+
return parameterInfo.getParameterName();
90+
}
91+
7492
private List<String> readVariablesAsTypeParameters(MethodInfo methodInfo) {
7593
List<String> result = new ArrayList<>();
7694
List<ParameterInfo> parameters =

spring-boot-starter-camunda/src/test/java/io/camunda/zeebe/spring/client/properties/PropertyBasedZeebeWorkerValueCustomizerTest.java

+19
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.assertj.core.api.Assertions.*;
44

5+
import io.camunda.zeebe.client.api.response.ActivatedJob;
56
import io.camunda.zeebe.spring.client.annotation.JobWorker;
67
import io.camunda.zeebe.spring.client.annotation.Variable;
78
import io.camunda.zeebe.spring.client.annotation.VariablesAsType;
@@ -38,6 +39,24 @@ private static ZeebeClientConfigurationProperties properties() {
3839
@JobWorker
3940
void sampleWorker(@Variable String var1, @VariablesAsType ComplexProcessVariable var2) {}
4041

42+
@JobWorker
43+
void activatedJobWorker(@Variable String var1, ActivatedJob activatedJob) {}
44+
45+
@Test
46+
void shouldNotAdjustVariableFilterVariablesAsActivatedJobIsInjected() {
47+
// given
48+
ZeebeClientConfigurationProperties properties = properties();
49+
PropertyBasedZeebeWorkerValueCustomizer customizer =
50+
new PropertyBasedZeebeWorkerValueCustomizer(properties);
51+
ZeebeWorkerValue zeebeWorkerValue = new ZeebeWorkerValue();
52+
zeebeWorkerValue.setFetchVariables(new String[] {"a", "var1", "b"});
53+
zeebeWorkerValue.setMethodInfo(methodInfo(this, "testBean", "activatedJobWorker"));
54+
// when
55+
customizer.customize(zeebeWorkerValue);
56+
// then
57+
assertThat(zeebeWorkerValue.getFetchVariables()).containsExactly("a", "var1", "b");
58+
}
59+
4160
@Test
4261
void shouldSetDefaultName() throws NoSuchMethodException {
4362
// given

0 commit comments

Comments
 (0)