As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<receiveTask id="waitState" name="wait" />
To continue a process instance that is currently waiting at such a receive task, the runtimeService.signal(executionId) must be called using the id of the execution that arrived in the receive task. The following code snippet shows how this works in practice:
ProcessInstance pi = runtimeService.startProcessInstanceByKey("receiveTask"); Execution execution = runtimeService.createExecutionQuery() .processInstanceId(pi.getId()) .activityId("wait") .singleResult(); assertNotNull(execution);
<br>TaskQuery taskQuery = processEngine.getTaskService().createTaskQuery();<br><br>List<Task> tasks = taskQuery.processInstanceId(processInstanceId).list();<br><br>for (Task task : tasks) {<br> if (task.getDelegationState == DelegationState.PENDING) {<br> // do stuff<br> }<br>}<br>
<br> // retrieve the current execution context of the process Id in the waiting state<br> Execution execution = runtimeService.createExecutionQuery()<br> .processInstanceId(businessProcess.getProcessInstanceId())<br> .messageEventSubscriptionName("continueMessage")<br> .singleResult();<br>
<br>runtimeService.createNativeExecutionQuery()<br>.sql("SELECT * FROM " + mgmtService.getTableName(Execution.class) + " WHERE PROC_INST_ID_ = #{processInstanceId} AND IS_ACTIVE_ = 1" ).parameter("processInstanceId", processInstance.getProcessInstanceId()).singleResult();<br>