LiteFlow provides detailed step information for the chain performed.
Step information is obtained through the
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "初始参数", CustomContext.class); Map<String, CmpStep> stepMap = response.getExecuteSteps(); //Or you can get a step queue with the following method Queue<CmpStep> stepQueue = response.getExecuteStepQueue();
The difference between the above two methods is:
The method that gets the return value of
Map, if there are same components defined in the rule, then the value of the component id in the
Map obtained is the final step information.
The method of obtaining the return value of
Queue<CmpStep> contains all the step information in the return value. If the same component is defined n times in the rule, there are also n steps.
CmpStep object, you can get the data you want by the following methods:
isSuccess: Whether this component was executed successfully
getNodeId: get the component Id
getNodeName: get the component name
getTag: get the component tag value
getTimeSpent: the time taken to get the component, in milliseconds
getException: Get the exception thrown by this component. If there is an exception, success must be false, but if success is false, there may not be an exception, because it may not be executed, or the execution will not end (any case).
If one of your components throws an exception, in the default configuration, the flow will be interrupted. Then
response.getCause() and the exception in the corresponding component step are consistent. And the components that are not executed will not have corresponding step information.