AnsweredAssumed Answered

Generating diagram form process instance always stays on the same initial task

Question asked by gioppoluca on Apr 23, 2015
Latest reply on Apr 24, 2015 by martin.grofcik
I'm using Activiti in a spring boot application and have a process that has the first activity as asynch as explained in this forum to get it executed from a rest call without keeping the API stuck.
The API return the processID
A second API query for the image of the running process:
Here is the method:

public InputStream getProcessImage(String id){
      System.out.println("ProcessID:"+id);
      ProcessInstance pi;
      pi = runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult();
      if (pi == null){
         return null;
      }
      System.out.println("Process execution:"+pi.getId());
      BpmnModel bmod = processEngine.getRepositoryService().getBpmnModel(pi.getProcessDefinitionId());
      List<String> actact = runtimeService.getActiveActivityIds(id);
      System.out.println("ActiveActivities:"+actact.toString());
      return new DefaultProcessDiagramGenerator().generateDiagram(bmod,"png",actact);
   }

The active activity is always the first one and the image always has that activiti highlighted even if the process executes normally.
Any hints?
thanks

Outcomes