Source:
public Void execute(Context context) { KieSession kieSession = ((RegistryContext) context).lookup(KieSession.class); logger.debug("About to trigger (create) node instance for node in process instance {}", nodeId, processInstanceId); RuleFlowProcessInstance wfp = (RuleFlowProcessInstance) kieSession.getProcessInstance(processInstanceId, false); if (wfp == null) { throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found"); } Node node = null; try { node = wfp.getRuleFlowProcess().getNode(nodeId); } catch (Exception e) { logger.debug("Node with id not found, searching it in workflow containers", nodeId); } if (node == null) { node = wfp.getRuleFlowProcess().getNodesRecursively().stream().filter(ni -> ni.getId() == nodeId).findFirst().orElse(null); if (node == null) { throw new NodeNotFoundException("Node with id " + nodeId + " not found"); } Node parentNode = wfp.getRuleFlowProcess().getParentNode(nodeId); Map<String, Object> parentNodeMetaData = parentNode.getMetaData(); Boolean oldWrapValue = (Boolean) parentNodeMetaData.get(NodeInstance.METADATA_WRAP_ASYNC_NODE); parentNodeMetaData.put(NodeInstance.METADATA_WRAP_ASYNC_NODE, false); NodeInstanceContainer nodeInstanceContainerNode = (NodeInstanceContainer) wfp.getNodeInstance(parentNode.getId()); parentNodeMetaData.put(NodeInstance.METADATA_WRAP_ASYNC_NODE, oldWrapValue); logger.debug("Triggering node on process instance {}", node, wfp); nodeInstanceContainerNode.getNodeInstance(node).trigger(null, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); logger.debug("Node successfully triggered", node); } else { logger.debug("Triggering node on process instance {}", node, wfp); wfp.getNodeInstance(node).trigger(null, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); logger.debug("Node successfully triggered", node); } return null; }

Target:
public Void execute(Context context) { KieSession kieSession = ((RegistryContext) context).lookup(KieSession.class); logger.debug("About to trigger (create) node instance for node in process instance {}", nodeId, processInstanceId); RuleFlowProcessInstance wfp = (RuleFlowProcessInstance) kieSession.getProcessInstance(processInstanceId, false); if (wfp == null) { throw new ProcessInstanceNotFoundException("Process instance with id " + processInstanceId + " not found"); } Node node = null; try { node = wfp.getRuleFlowProcess().getNode(nodeId); } catch (Exception e) { logger.debug("Node with id not found, searching it in workflow containers", nodeId); } if (node == null) { node = wfp.getRuleFlowProcess().getNodesRecursively().stream().filter(ni -> ni.getId() == nodeId).findFirst().orElse(null); if (node == null) { throw new NodeNotFoundException("Node with id " + nodeId + " not found"); } Node parentNode = wfp.getRuleFlowProcess().getParentNode(nodeId); NodeInstanceContainer parentContainer = (NodeInstanceContainer) wfp.getNodeInstance(parentNode, false); logger.debug("Triggering node on process instance {}", node, wfp); parentContainer.getNodeInstance(node).trigger(null, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); logger.debug("Node successfully triggered", node); } else { logger.debug("Triggering node on process instance {}", node, wfp); wfp.getNodeInstance(node).trigger(null, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE); logger.debug("Node successfully triggered", node); } return null; }