Skip to main content

Create a workflow instance with results

Prerequisites​

  1. Running Zeebe broker with endpoint localhost:26500 (default)
  2. Run the deploy a workflow example. Deploy demoProcessSingleTask.bpmn instead of demoProcess.bpmn

WorkflowInstanceWithResultCreator.java​

Source on github

final WorkflowInstanceResult workflowInstanceResult =
client
.newCreateInstanceCommand()
.bpmnProcessId(bpmnProcessId)
.latestVersion()
.withResult() // to await the completion of workflow execution and return result
.send()
.join();

System.out.println(
"Workflow instance created with key: "
+ workflowInstanceResult.getWorkflowInstanceKey()
+ " and completed with results: "
+ workflowInstanceResult.getVariables());