Hello Everyone !
I try to create some User tasks in JobWorker by making a collection like:
[{"name":"demo"},{"name":"john"}]
I send array to Zeebe Brocker in variable namesArray.
The source of java code is here:
@ZeebeWorker(type = "NamesList")
public void NamesList(final JobClient client, final ActivatedJob job) {
String[] namesArray = {"{\"name\":\"demo\"}", "{\"name\":\"john\"}"};
System.out.println("namesArray[0]=" + namesArray[0] + "\n namesArray[1]=" + namesArray[1]);
HashMap<String, Object> variables = new HashMap<>();
variables.put("namesArray", namesArray);
client.newCompleteCommand(job.getKey())
.variables(variables)
.send()
.exceptionally((throwable -> {
throw new RuntimeException("Could not complete job", throwable);
}));
}
JobWorker works fine:
The process cteate two Multi-instance subprocesses, but with error on every User Task:
failed to evaluate expression ‘myArray.name’: No property found with name ‘name’ of value ‘ValString({“name”:“john”})’. Available properties:
The process diagram is here:
Multi-instance_subprocess_JobWorker_v01.bpmn (5.3 KB)
As I can see, process variable namesArray containes slashes
Is it correct ? I have no slashes in java output. Maybe this is my problem, but I don’t know how to remove they. Is it possible ?
Could you help me, please, to understand what’s wrong in my JobWorker’s java code ?