I'm trying to get a specific Execution from a running process. In order to assure that there is nothing wrong with the filtering, I used a very simple query. All active Executions should be found. Exactly 1.
mProcessEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
RepositoryService repositoryService = mProcessEngine.getRepositoryService();
repositoryService.createDeployment().addClasspathResource( processFilePath).deploy();
Map<String, Object> variableMap = new HashMap<String, Object>();
RuntimeService runService = mProcessEngine.getRuntimeService();
ProcessInstance processInstance = runService.startProcessInstanceByKey( processId, variableMap);
List <Execution> executions = runService.createExecutionQuery().list();
The process instance gets started correctly, 2 tasks are executed until the process is waiting for a signal. This works as expected. But I don't get why the execution list is empty. If I query the Historic instances I get one result (as expected):
HistoryService historyService = mProcessHandler.getProcessEngine().getHistoryService();
List<HistoricProcessInstance> allInstances = historyService.createHistoricProcessInstanceQuery().list();
Any ideas what is wrong with the query?
Update I figured out that the execution list is empty (even after waiting for seconds) if the execution is waiting for a boundary event signal. If the boundary event is removed the execution list returns 1.