Source:
private void initProcessActivationListener() { kruntime.addEventListener(new DefaultAgendaEventListener() { public void matchCreated(MatchCreatedEvent event) { String ruleFlowGroup = ((RuleImpl) event.getMatch().getRule()).getRuleFlowGroup(); if ( "DROOLS_SYSTEM".equals( ruleFlowGroup ) ) { String ruleName = event.getMatch().getRule().getName(); String rulePrefix = "RuleFlowStateNode-"; if (ruleName.startsWith(rulePrefix)) { int index = ruleName.indexOf('-', rulePrefix.length() + 1); int numberOfHyphens = (int) ruleName.chars().filter(ch -> ch == '-').count(); index = ordinalIndexOf(ruleName, '-', numberOfHyphens - 1); String eventType = ruleName.substring(0, index); kruntime.queueWorkingMemoryAction(new SignalManagerSignalAction(eventType, event)); } else if (ruleName.startsWith( "RuleFlowStateEventSubProcess-" ) || ruleName.startsWith( "RuleFlowStateEvent-" ) || ruleName.startsWith( "RuleFlow-Milestone-" ) || ruleName.startsWith( "RuleFlow-AdHocComplete-" ) || ruleName.startsWith( "RuleFlow-AdHocActivate-" )) { kruntime.queueWorkingMemoryAction(new SignalManagerSignalAction(ruleName, event)); } } else { String ruleName = event.getMatch().getRule().getName(); if ( ruleName.startsWith( "RuleFlow-Start-" )) { String processId = ruleName.replace("RuleFlow-Start-", ""); startProcessWithParamsAndTrigger(processId, null, "conditional", true); } } } }); kruntime.addEventListener(new DefaultAgendaEventListener() { public void afterRuleFlowGroupDeactivated(final RuleFlowGroupDeactivatedEvent event) { if (kruntime instanceof StatefulKnowledgeSession) { signalManager.signalEvent( "RuleFlowGroup_" + event.getRuleFlowGroup().getName() + "_" + ((StatefulKnowledgeSession) kruntime).getIdentifier(), null ); } else { signalManager.signalEvent( "RuleFlowGroup_" + event.getRuleFlowGroup().getName(), null ); } } } ); }

Target:
private void initProcessActivationListener() { kruntime.addEventListener(new DefaultAgendaEventListener() { public void matchCreated(MatchCreatedEvent event) { String ruleFlowGroup = ((RuleImpl) event.getMatch().getRule()).getRuleFlowGroup(); if ( "DROOLS_SYSTEM".equals( ruleFlowGroup ) ) { String ruleName = event.getMatch().getRule().getName(); String rulePrefix = "RuleFlowStateNode-"; if (ruleName.startsWith(rulePrefix)) { int index = ruleName.lastIndexOf('-'); index = ruleName.lastIndexOf('-', index - 1); String eventType = ruleName.substring(0, index); kruntime.queueWorkingMemoryAction(new SignalManagerSignalAction(eventType, event)); } else if (ruleName.startsWith( "RuleFlowStateEventSubProcess-" ) || ruleName.startsWith( "RuleFlowStateEvent-" ) || ruleName.startsWith( "RuleFlow-Milestone-" ) || ruleName.startsWith( "RuleFlow-AdHocComplete-" ) || ruleName.startsWith( "RuleFlow-AdHocActivate-" )) { kruntime.queueWorkingMemoryAction(new SignalManagerSignalAction(ruleName, event)); } } else { String ruleName = event.getMatch().getRule().getName(); if ( ruleName.startsWith( "RuleFlow-Start-" )) { String processId = ruleName.replace("RuleFlow-Start-", ""); startProcessWithParamsAndTrigger(processId, null, "conditional", true); } } } }); kruntime.addEventListener(new DefaultAgendaEventListener() { public void afterRuleFlowGroupDeactivated(final RuleFlowGroupDeactivatedEvent event) { if (kruntime instanceof StatefulKnowledgeSession) { signalManager.signalEvent( "RuleFlowGroup_" + event.getRuleFlowGroup().getName() + "_" + ((StatefulKnowledgeSession) kruntime).getIdentifier(), null ); } else { signalManager.signalEvent( "RuleFlowGroup_" + event.getRuleFlowGroup().getName(), null ); } } } ); }