🍡Step information
LiteFlow provides detailed step information for the chain performed.
Step information is obtained through the LiteflowResponse
object:
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:
tip
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.
In the CmpStep
object, you can get the data you want by the following methods:
isSuccess
: Whether this component was executed successfullygetNodeId
: get the component IdgetNodeName
: get the component namegetTag
: get the component tag valuegetTimeSpent
: the time taken to get the component, in millisecondsgetException
: 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).
tip
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.