Retrieving results from process instance

I have the following running service. Its an extension of the dish tutorial. combining bpmn with dmn.

public class ProcessService {

    private RuntimeService runtimeService;

    public String getDish(){
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("DishGenerator");
        return unsureAboutThisBit;
        // how do I get the dish response that was set on the final JavaDelegate task do I save it to a variable?

My final task int he BPMN looks like this

public class DishReviewDelegate implements JavaDelegate {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public void execute(DelegateExecution execution) throws Exception {"reviewing output of dish decision");"available keys:{}", execution.getVariables().keySet());
        String dish = (String) execution.getVariable("dish");
        String result = (String) execution.getVariable("result");"dish is {} ", dish);

So my question is this… How do I get the dish value from the ProcessService class - the one that triggers the process?

Hi @Rob_Davidson,

Assuming there are no wait states in the process, you can use the documented here to access the variables of the completed process instance.


@thorben which rest API can be used?

Hi @abc-xyz,

Have a look at below example of starting a process instance with variables in return