<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-spring-boot-starter</artifactId>
<version>2.10.3</version>
</dependency>
2.新建三个流程类
@Component("a")
public class ACmp extends NodeComponent {
@Override
public void process() {
System.out.println("111");
}
}
@Component("b")
public class BCmp extends NodeComponent {
@Override
public void process() {
System.out.println("222");
}
}
@Component("c")
public class CCmp extends NodeComponent {
@Override
public void process() {
System.out.println("333");
}
}
3.在resources下的config/flow.el.xml中定义规则
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<chain name="chain1">
THEN(a, b, c);
</chain>
</flow>
- application.properties
liteflow.rule-source=config/flow.el.xml
5.增加调用类
@Component
public class YourClass{
@Resource
private FlowExecutor flowExecutor;
public void testConfig(){
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
}
}
6.触发
@RestController
public class Controller {
@Autowired
YourClass yourClass;
@GetMapping("/test")
public void test() {
yourClass.testConfig();
}
}
7.效果
image.png
网友评论