Skip to content

Commit

Permalink
In case of a timer event, only process event sub process when no time…
Browse files Browse the repository at this point in the history
…r job is present
  • Loading branch information
basclaessen committed Jul 24, 2024
1 parent 6e8049c commit b94a0a5
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,21 @@ protected void processPendingEventSubProcessesStartEvents(ProcessInstanceChangeS
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
ProcessInstanceHelper processInstanceHelper = processEngineConfiguration.getProcessInstanceHelper();
EventSubscriptionService eventSubscriptionService = processEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService();
ManagementService managementService = processEngineConfiguration.getManagementService();

for (Map.Entry<? extends StartEvent, ExecutionEntity> pendingStartEventEntry : processInstanceChangeState.getPendingEventSubProcessesStartEvents().entrySet()) {
StartEvent startEvent = pendingStartEventEntry.getKey();
ExecutionEntity parentExecution = pendingStartEventEntry.getValue();
EventDefinition eventDefinition = startEvent.getEventDefinitions().isEmpty() ? null : startEvent.getEventDefinitions().get(0);

//Process event sub process when no subscriptions are found
if (eventSubscriptionService.findEventSubscriptionsByExecution(parentExecution.getId()).isEmpty()) {
//Process event sub process when no subscriptions/timer jobs are found
boolean processEventSubProcess = false;
if (eventDefinition instanceof TimerEventDefinition) {
processEventSubProcess = managementService.createTimerJobQuery().executionId(parentExecution.getId()).list().isEmpty();
} else {
processEventSubProcess = eventSubscriptionService.findEventSubscriptionsByExecution(parentExecution.getId()).isEmpty();
}
if (processEventSubProcess) {
processInstanceHelper.processEventSubProcess(parentExecution, (EventSubProcess) startEvent.getSubProcess(), commandContext);
}
}
Expand Down

0 comments on commit b94a0a5

Please sign in to comment.