Hello guys,
I’m developing a Job Worker in Spring Boot 3.0.5 using spring-boot-starter-camunda:8.2.4.
I’m also using Camunda Cloud on SaaS.
My worker should execute some logic and, in some cases, throws an error and to add a variable to the process.
For this purpose I’m using this code:
@JobWorker(type = "service-task-test-2", autoComplete = false)
public void handleServiceTestTask(final JobClient client, final ActivatedJob job) {
// SOME LOGIC HERE....
Map<String, Object> variablesMap = job.getVariablesAsMap();
variablesMap.put("new_var", 999);
client.newThrowErrorCommand(job.getKey())
.errorCode("Error_99")
.variables(variablesMap)
.send()
.join();
}
And this is a subset of my process:
I expect that the variables map of Service Task 3 should contains the new variable new_var, but it doesn’t.
It seem that .variables(variablesMap) is ignored.
What’s wrong with my approach?
Can you help me?
Regards,