🛫Execute
# Initialize FlowExecutor
You can easily initialize the FlowExecutor
processor with the following code:
LiteflowConfig config = new LiteflowConfig();
config.setRuleSource("config/flow.el.xml");
FlowExecutor flowExecutor = FlowExecutorHolder.loadInstance(config);
For more configuration items, please refer to the Configuration Items chapter.
notice
It should be noted that it is not recommended to initialize the FlowExecutor
every time the execution process is performed. The initialization of this object is relatively heavy, and it only needs to be initialized once globally. It is recommended to initialize when the project is started or when it is executed for the first time.
# Execute with FlowExecutor
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
notice
This DefaultContext
is the default context. Users can use their own arbitrary bean as the context to pass in. If they need to pass in their own context, they need to pass the Class attribute of the user bean. For details, please refer to Data context this chapter.