Search code examples
bpmncamundacamunda-modelerdmn

DMN / Camunda Modeller: how to define a Parallel Multi Instance Result


I want to include a decision table in my process.

As the input is a list of elements, I want to call it for each element in parallel.

When I look at the output it only includes one entry. So it seems that each execution overrides the previous one. Example: [{pricePerProcessInstance=150.0, pricePerTask=0.0}]

I suspect I do something wrong in the definition.

Here is the definition for it:

dmn definition


Solution

  • I believe that the Execution Listener (1) should solve your problem.

    You could configure an end execution listener as depicted here

    Please take a look at the example implementation of class defined in the listener section above.

    public class MyService implements JavaDelegate {
    
      @Override
      public void execute(DelegateExecution delegateExecution) {
        List<String> resultList = (List<String>) delegateExecution.getVariable("resultList");
    
        if (resultList == null) {
          resultList = new ArrayList<>();
        }
    
        resultList.add((String) delegateExecution.getVariable("processPrices"));
    
        delegateExecution.setVariable("resultList", resultList);
    
      }
    
    }
    

    In every execution of the decision table the result variable processPrices will be added to the ArrayList resultList.

    (1) https://docs.camunda.org/manual/latest/user-guide/process-engine/delegation-code/#execution-listener