🍉Component Parameters
LiteFlow supports the component parameter feature since v2.9.0. You can set external parameters for components in EL syntax.
This is a very useful feature for orchestrating the same components.
You can use the data
keyword to set external parameters for a component, preferably in JSON format:
<flow>
<chain name="chain1">
cmpData = '{"name":"jack","age":27,"birth":"1995-10-01"}';
THEN(a, b.data(cmpData), c);
</chain>
<chain name="chain2">
cmpData = '{"name":"rose","age":20,"birth":"1997-07-01"}';
WHEN(c, b.data(cmpData));
</chain>
</flow>
In the above expression, the same b component is given different external parameters in different chains, and the corresponding parameters can also be obtained through the getCmpData
method in the component during operation.
This method can return the java object of the corresponding structure, as long as the corresponding class is passed in.
@Component("b")
public class BCmp extends NodeComponent {
@Override
public void process() {
User user = this.getCmpData(User.class);
...
}
}
Help us improve this document (opens new window)
last update: 2022/11/30, 22:42:09