Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-3756

NodeLeftEvent is not fired for nodes in ad-hoc process

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Minor Minor
    • jBPM 5.4.0.Beta1
    • jBPM 5.3
    • Runtime Engine
    • None

      NodeLeftEvent is fired from NodeInstanceImpl.triggerNodeInstance()

      Thread [main] (Suspended (breakpoint at line 126 in JPAWorkingMemoryDbLogger))  
          JPAWorkingMemoryDbLogger.addNodeExitLog(long, String, String, String, String) line: 126 
          JPAWorkingMemoryDbLogger.logEventCreated(LogEvent) line: 87 
          JPAWorkingMemoryDbLogger(WorkingMemoryLogger).filterLogEvent(LogEvent) line: 196    
          JPAWorkingMemoryDbLogger(WorkingMemoryLogger).beforeNodeLeft(ProcessNodeLeftEvent) line: 506    
          ProcessEventSupport.fireBeforeNodeLeft(NodeInstance, KnowledgeRuntime) line: 112    
          HumanTaskNodeInstance(NodeInstanceImpl).triggerNodeInstance(NodeInstance, String) line: 192 
          HumanTaskNodeInstance(NodeInstanceImpl).triggerCompleted(String, boolean) line: 155 
          HumanTaskNodeInstance(ExtendedNodeInstanceImpl).triggerCompleted(String, boolean) line: 47  
          HumanTaskNodeInstance(StateBasedNodeInstance).triggerCompleted(String, boolean) line: 162   
          HumanTaskNodeInstance(StateBasedNodeInstance).triggerCompleted() line: 143  
          HumanTaskNodeInstance(WorkItemNodeInstance).triggerCompleted(WorkItem) line: 239    
          HumanTaskNodeInstance.triggerCompleted(WorkItem) line: 90   
          HumanTaskNodeInstance(WorkItemNodeInstance).workItemAborted(WorkItem) line: 293 
          HumanTaskNodeInstance(WorkItemNodeInstance).signalEvent(String, Object) line: 279   
          RuleFlowProcessInstance(WorkflowProcessInstanceImpl).signalEvent(String, Object) line: 338  
          JPAWorkItemManager.abortWorkItem(long) line: 154    
          AbortWorkItemCommand.execute(Context) line: 56  
          AbortWorkItemCommand.execute(Context) line: 29  
          DefaultCommandService.execute(Command<T>) line: 36  
          SingleSessionCommandService.execute(Command<T>) line: 355   
          CommandBasedStatefulKnowledgeSession$1.abortWorkItem(long) line: 156    
          SyncWSHumanTaskHandler$TaskCompletedHandler.handleCompletedTask(long) line: 378 
      

      But in case the node doesn't have outgoing connections — the nodes in adhoc process, NodeInstanceContainer.nodeInstanceCompleted() is called instead of NodeInstanceImpl.triggerNodeInstance().

          protected void triggerCompleted(String type, boolean remove) {
      ...
              	} else {
              		connections = node.getOutgoingConnections(type);
              	}
              }
              if (connections == null || connections.isEmpty()) {
              	((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer())
              		.nodeInstanceCompleted(this, type);
              } else {
              	Map<org.jbpm.workflow.instance.NodeInstance, String> nodeInstances = 
              		new HashMap<org.jbpm.workflow.instance.NodeInstance, String>();
              	for (Connection connection: connections) {
              		nodeInstances.put(followConnection(connection), connection.getToType());
              	}
              	for (Map.Entry<org.jbpm.workflow.instance.NodeInstance, String> nodeInstance: nodeInstances.entrySet()) {
      	        	// stop if this process instance has been aborted / completed
      	        	if (((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).getState() != ProcessInstance.STATE_ACTIVE) {
      	        		return;
      	        	}
      	    		triggerNodeInstance(nodeInstance.getKey(), nodeInstance.getValue());
      	        }
              }
          }
      

      As a result, JPAWorkingMemoryDbLogger doesn't add EXIT logs for those nodes.

      I think it's not a bug but just designed so. However, EXIT logs are important BAM elements so it would be great if nodes in adhoc process can generate them.

              kverlaen@redhat.com Kris Verlaenen
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: