I have one jobworker configured in java side and trying update the process variable after completion with the help of below code. And code got executed without any issue but I am unable to see these variables in operate.
@JobWorker(type = WorkerName.LOAD_URLS, fetchAllVariables = true)
public void connectorURLs(final JobClient jobClient, final ActivatedJob activatedJob) {
log.info("Worker:{} has been started.",WorkerName.LOAD_URLS);
Map<String, Object> variables = activatedJob.getVariablesAsMap();
log.info("available variables:{}",variables.toString());
variables.put(CONNECTOR_URLS, CamundaServiceApp.connectorUrls);
variables.put(HttpHeaders.AUTHORIZATION.toLowerCase(), getJWTToken());
log.info("New variables:{}",variables);
zeebeClient.newCompleteCommand(activatedJob).variables(variables)
.send();
}
Screenshot of BPMN process from operate where we can see no variables after execution.
You may be looking at Operate wrong. I know that it doesn’t work the way I think it should in viewing variables, but I can never remember exactly how.
Put another service task in there - after your existing one - and in the handler log out the variable payload. From your code, it looks like it should be working.
In Operate, click around: on the element, on the canvas.
I think the suggestion was to leverage the code you’ve already written…
If you duplicate your code, and put a second service worker after the first one, your logs should show the variables that the instance has…
@JobWorker(type = "VERIFY_VARS", fetchAllVariables = true)
public void connectorURLs(final JobClient jobClient, final ActivatedJob activatedJob) {
log.info("Worker:VERIFY_VARS has been started.");
Map<String, Object> variables = activatedJob.getVariablesAsMap();
log.info("available variables:{}",variables.toString());
zeebeClient.newCompleteCommand(activatedJob)
.send();
}