测试并行
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.lanyuanxiaoyao.ai.analysis;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.net.http.HttpClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
@@ -18,8 +21,13 @@ public class AnalysisApplication implements ApplicationRunner {
|
||||
SpringApplication.run(AnalysisApplication.class, args);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain_1");
|
||||
log.info(String.valueOf(response.isSuccess()));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.lanyuanxiaoyao.ai.analysis.flow;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@LiteflowComponent
|
||||
public class RunningFlow {
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "A")
|
||||
public void processA(NodeComponent bind){
|
||||
log.info("Process A");
|
||||
}
|
||||
|
||||
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "B")
|
||||
public void processB(NodeComponent bind){
|
||||
log.info("Process B");
|
||||
}
|
||||
}
|
||||
@@ -48,3 +48,6 @@ logging:
|
||||
level:
|
||||
# root: debug
|
||||
org.springframework.ai: debug
|
||||
liteflow:
|
||||
print-banner: false
|
||||
rule-source: config/flow.xml
|
||||
6
src/main/resources/config/flow.xml
Normal file
6
src/main/resources/config/flow.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<chain name="chain_1">
|
||||
SER(A,B)
|
||||
</chain>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user