mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
删除测试工程
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>liteflow-test-spring</artifactId>
|
||||
|
||||
<parent>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>2.5.11</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.yomahub.flowtest;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.entity.data.LiteflowResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public class Runner {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Runner.class);
|
||||
private static ClassPathXmlApplicationContext context;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
context = new ClassPathXmlApplicationContext(new String[]{"/applicationContext.xml"});
|
||||
context.start();
|
||||
log.info("启动成功");
|
||||
FlowExecutor flowExecutor = context.getBean(FlowExecutor.class);
|
||||
LiteflowResponse response = flowExecutor.execute2Resp("chain3", "it's a request");
|
||||
System.out.println(response);
|
||||
|
||||
while (true){
|
||||
Thread.sleep(60000);
|
||||
}
|
||||
|
||||
// System.exit(0);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("a")
|
||||
public class AComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
String str = this.getSlot().getRequestData();
|
||||
System.out.println(str);
|
||||
System.out.println("Acomponent executed!");
|
||||
|
||||
this.getSlot().setOutput(this.getNodeId(), "A component output");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("b")
|
||||
public class BComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
Thread.sleep(400L);
|
||||
String[] temp = new String[1000];
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Bcomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("c")
|
||||
public class CComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
String[] temp = new String[4000];
|
||||
Thread.sleep(300L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.getSlot().setData("m_flag",4);
|
||||
System.out.println("Ccomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* <p>Title: litis</p>
|
||||
* <p>Description: redis的全方位开发运维平台</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email 47483522@qq.com
|
||||
* @Date 2017-11-28
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("cond")
|
||||
public class CondComponent extends NodeCondComponent {
|
||||
|
||||
@Override
|
||||
public String processCond() throws Exception {
|
||||
return "b";
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("d")
|
||||
public class DComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
Slot slot = this.getSlot();
|
||||
String e = slot.getOutput("e");
|
||||
if(e == null){
|
||||
System.out.println(slot);
|
||||
}
|
||||
System.out.println("D:" + slot.getOutput("e"));
|
||||
|
||||
String[] temp = new String[1400];
|
||||
Thread.sleep(450L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Dcomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("e")
|
||||
public class EComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
Thread.sleep(120L);
|
||||
System.out.println("E:" + this.getSlot().getOutput("a"));
|
||||
this.getSlot().setOutput(this.getNodeId(), "E component output");
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Eomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("f")
|
||||
public class FComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
String[] temp = new String[400];
|
||||
Thread.sleep(40L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Fcomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("g")
|
||||
public class GComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("Gcomponent executed!");
|
||||
this.getSlot().setResponseData("i am a response");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.DefaultSlot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("h")
|
||||
public class HComponent extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("Hcomponent executed!");
|
||||
try{
|
||||
flowExecutor.invoke("strategy1",3, DefaultSlot.class, this.getSlotIndex());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m1")
|
||||
public class M1Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m1 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m2")
|
||||
public class M2Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m2 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.DefaultSlot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m3")
|
||||
public class M3Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m3 component executed!");
|
||||
try{
|
||||
flowExecutor.invoke("strategy2",10, DefaultSlot.class, this.getSlotIndex());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m")
|
||||
public class MComponent extends NodeCondComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public String processCond() throws Exception {
|
||||
System.out.println("m conponent executed");
|
||||
Integer flag = this.getSlot().getData("m_flag");
|
||||
if(flag == 1) {
|
||||
return "m1";
|
||||
}else if(flag == 2){
|
||||
return "m2";
|
||||
}else if(flag == 3){
|
||||
return "m3";
|
||||
}else{
|
||||
return "strategy2";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("p1")
|
||||
public class P1Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("p1 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("p2")
|
||||
public class P2Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("p2 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("p")
|
||||
public class PComponent extends NodeCondComponent {
|
||||
|
||||
@Override
|
||||
public String processCond() throws Exception {
|
||||
System.out.println("p conponent executed");
|
||||
Integer flag = this.getSlot().getData("p_flag");
|
||||
if(flag == 10) {
|
||||
return "p1";
|
||||
}else {
|
||||
return "p2";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("q")
|
||||
public class QComponent extends NodeComponent {
|
||||
@Override
|
||||
public void process() throws Exception {
|
||||
this.getSlot().setData("p_flag",10);
|
||||
System.out.println("Qcomponent executed!");
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
|
||||
|
||||
<context:component-scan base-package="com.yomahub.flowtest.components" />
|
||||
|
||||
<bean id="springAware" class="com.yomahub.liteflow.util.SpringAware"/>
|
||||
|
||||
<bean class="com.yomahub.liteflow.spring.ComponentScanner"/>
|
||||
|
||||
<bean id="liteflowConfig" class="com.yomahub.liteflow.property.LiteflowConfig">
|
||||
<property name="ruleSource" value="config/flow.xml"/>
|
||||
<property name="slotSize" value="2024"/>
|
||||
<property name="whenMaxWaitSeconds" value="20"/>
|
||||
<property name="enableLog" value="true"/>
|
||||
<property name="queueLimit" value="100"/>
|
||||
<property name="period" value="5000"/>
|
||||
<property name="delay" value="5000"/>
|
||||
<property name="whenMaxWorkers" value="3"/>
|
||||
<property name="whenQueueLimit" value="512"/>
|
||||
</bean>
|
||||
|
||||
<bean id="flowExecutor" class="com.yomahub.liteflow.core.FlowExecutor">
|
||||
<property name="liteflowConfig" ref="liteflowConfig"/>
|
||||
</bean>
|
||||
|
||||
<bean class="com.yomahub.liteflow.monitor.MonitorBus">
|
||||
<property name="liteflowConfig" ref="liteflowConfig"/>
|
||||
</bean>
|
||||
|
||||
<bean id="whenExecutors" class="com.yomahub.liteflow.util.LiteFlowExecutorPoolShutdown"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<!-- 如果和spring集成,以下<nodes>配置可以不要
|
||||
<nodes>
|
||||
<node id="a" class="com.yomahub.liteflow.test.component.AComponent"/>
|
||||
<node id="b" class="com.yomahub.liteflow.test.component.BComponent"/>
|
||||
<node id="c" class="com.yomahub.liteflow.test.component.CComponent"/>
|
||||
<node id="d" class="com.yomahub.liteflow.test.component.DComponent"/>
|
||||
<node id="e" class="com.yomahub.liteflow.test.component.EComponent"/>
|
||||
<node id="f" class="com.yomahub.liteflow.test.component.FComponent"/>
|
||||
<node id="g" class="com.yomahub.liteflow.test.component.GComponent"/>
|
||||
<node id="cond" class="com.yomahub.liteflow.test.component.CondComponent"/>
|
||||
</nodes>
|
||||
-->
|
||||
|
||||
<chain name="chain1">
|
||||
<then value="a,cond(b|d)"/> <!-- cond是条件节点,根据cond里的逻辑决定路由到b节点还是d节点,可以配置多个 -->
|
||||
<then value="e,f,g"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain2">
|
||||
<then value="a,c"/> <!-- then表示串行 -->
|
||||
<when value="b,d"/> <!-- when表示串行 -->
|
||||
<then value="e,f,g"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain3">
|
||||
<then value="a,c,strategy1,g"/>
|
||||
</chain>
|
||||
|
||||
<chain name="strategy1">
|
||||
<then value="m(m1|m2|m3|strategy2)"/>
|
||||
</chain>
|
||||
|
||||
<chain name="strategy2">
|
||||
<then value="q,p(p1|p2)"/>
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2010-2011 The myBatis Team
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration debug="false">
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||
<property name="APP_NAME" value="test"/>
|
||||
<property name="LOG_HOME" value="./logs" />
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${LOG_HOME}/${APP_NAME}.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<!--日志文件大小-->
|
||||
<maxFileSize>1000MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>liteflow-test-springboot</artifactId>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>2.5.11</version>
|
||||
</parent>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<!-- Import dependency management from Spring Boot -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.yomahub.flowtest;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Runner {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try{
|
||||
SpringApplication.run(Runner.class, args);
|
||||
System.exit(0);
|
||||
}catch (Throwable t){
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.yomahub.flowtest;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.entity.data.LiteflowResponse;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class TestFlow implements CommandLineRunner {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
LiteflowResponse response= flowExecutor.execute2Resp("chain3", "it's a request");
|
||||
System.out.println(response);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("a")
|
||||
public class AComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
String str = this.getSlot().getRequestData();
|
||||
System.out.println(str);
|
||||
System.out.println("Acomponent executed!");
|
||||
|
||||
this.getSlot().setOutput(this.getNodeId(), "A component output");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("b")
|
||||
public class BComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
Thread.sleep(400L);
|
||||
String[] temp = new String[1000];
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Bcomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("c")
|
||||
public class CComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
String[] temp = new String[4000];
|
||||
Thread.sleep(300L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.getSlot().setData("m_flag",3);
|
||||
System.out.println("Ccomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* <p>Title: litis</p>
|
||||
* <p>Description: redis的全方位开发运维平台</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email 47483522@qq.com
|
||||
* @Date 2017-11-28
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("cond")
|
||||
public class CondComponent extends NodeCondComponent {
|
||||
|
||||
@Override
|
||||
public String processCond() throws Exception {
|
||||
return "b";
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("d")
|
||||
public class DComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("Dcomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("e")
|
||||
public class EComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
Thread.sleep(120L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Eomponent executed!");
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("f")
|
||||
public class FComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
String[] temp = new String[400];
|
||||
Thread.sleep(40L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Fcomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("g")
|
||||
public class GComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try{
|
||||
Thread.sleep(6000);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
System.out.println("Gcomponent executed!");
|
||||
this.getSlot().setResponseData("i am a response");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.DefaultSlot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("h")
|
||||
public class HComponent extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("Hcomponent executed!");
|
||||
try{
|
||||
flowExecutor.invoke("strategy1",3, DefaultSlot.class, this.getSlotIndex());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m1")
|
||||
public class M1Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m1 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m2")
|
||||
public class M2Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m2 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.DefaultSlot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m3")
|
||||
public class M3Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m3 component executed!");
|
||||
try{
|
||||
flowExecutor.invoke("strategy2",10, DefaultSlot.class, this.getSlotIndex());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import com.yomahub.liteflow.entity.flow.Executable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("m")
|
||||
public class MComponent extends NodeCondComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public String processCond() throws Exception {
|
||||
System.out.println("m conponent executed");
|
||||
Integer flag = this.getSlot().getData("m_flag");
|
||||
if(flag == 1) {
|
||||
return "m1";
|
||||
}else if(flag == 2){
|
||||
return "m2";
|
||||
}else {
|
||||
return "strategy2";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("p1")
|
||||
public class P1Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("p1 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("p2")
|
||||
public class P2Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("p2 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component("p")
|
||||
public class PComponent extends NodeCondComponent {
|
||||
|
||||
@Override
|
||||
public String processCond() throws Exception {
|
||||
System.out.println("p conponent executed");
|
||||
Integer flag = this.getSlot().getData("p_flag");
|
||||
if(flag == 10) {
|
||||
return "p1";
|
||||
}else {
|
||||
return "p2";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("q")
|
||||
public class QComponent extends NodeComponent {
|
||||
@Override
|
||||
public void process() throws Exception {
|
||||
this.getSlot().setData("p_flag",10);
|
||||
System.out.println("Qcomponent executed!");
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.yomahub.flowtest.custom;
|
||||
|
||||
import com.yomahub.liteflow.parser.ClassXmlFlowParser;
|
||||
|
||||
/**
|
||||
* @author guodongqing
|
||||
* @since 2.5.0
|
||||
*/
|
||||
public class CustomXmlClass extends ClassXmlFlowParser {
|
||||
@Override
|
||||
public String parseCustom() {
|
||||
String content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"<flow>\n" +
|
||||
"\t<chain name=\"chain4\">\n" +
|
||||
"\t\t<then value=\"a,cond(b|d)\"/>\n" +
|
||||
"\t\t<then value=\"e,f,g\"/>\n" +
|
||||
"\t</chain>\n" +
|
||||
"</flow>";
|
||||
return content;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
liteflow.rule-source=config/flow.xml
|
||||
liteflow.when-max-wait-seconds=20
|
||||
liteflow.monitor.enable-log=true
|
||||
liteflow.monitor.queue-limit=300
|
||||
liteflow.monitor.delay=10000
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
"flow": {
|
||||
"nodes": {
|
||||
"node": [
|
||||
{
|
||||
"id": "a",
|
||||
"class": "com.yomahub.liteflow.test.component.AComponent"
|
||||
},
|
||||
{
|
||||
"id": "b",
|
||||
"class": "com.yomahub.liteflow.test.component.BComponent"
|
||||
},
|
||||
{
|
||||
"id": "c",
|
||||
"class": "com.yomahub.liteflow.test.component.CComponent"
|
||||
},
|
||||
{
|
||||
"id": "d",
|
||||
"class": "com.yomahub.liteflow.test.component.DComponent"
|
||||
},
|
||||
{
|
||||
"id": "e",
|
||||
"class": "com.yomahub.liteflow.test.component.EComponent"
|
||||
},
|
||||
{
|
||||
"id": "f",
|
||||
"class": "com.yomahub.liteflow.test.component.FComponent"
|
||||
},
|
||||
{
|
||||
"id": "g",
|
||||
"class": "com.yomahub.liteflow.test.component.GComponent"
|
||||
},
|
||||
{
|
||||
"id": "cond",
|
||||
"class": "com.yomahub.liteflow.test.component.CondComponent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"chain": [
|
||||
{
|
||||
"name": "chain1",
|
||||
"condition": [
|
||||
{"type": "then", "value": "a,cond(b|d)"},
|
||||
{"type": "then", "value": "e,f,g"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chain2",
|
||||
"condition": [
|
||||
{"type": "then", "value": "a,c"},
|
||||
{"type": "when", "value": "b,d,e,f,g"},
|
||||
{"type": "then", "value": "c"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "chain3",
|
||||
"condition": [
|
||||
{"type": "then", "value": "a,c,strategy1,g"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "strategy1",
|
||||
"condition": [
|
||||
{"type": "then", "value": "m(m1|m2|strategy2)"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "strategy2",
|
||||
"condition": [
|
||||
{"type": "then", "value": "q,p(p1|p2)"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<!-- 如果和spring集成,以下<nodes>配置可以不要
|
||||
<nodes>
|
||||
<node id="a" class="com.yomahub.liteflow.test.component.AComponent"/>
|
||||
<node id="b" class="com.yomahub.liteflow.test.component.BComponent"/>
|
||||
<node id="c" class="com.yomahub.liteflow.test.component.CComponent"/>
|
||||
<node id="d" class="com.yomahub.liteflow.test.component.DComponent"/>
|
||||
<node id="e" class="com.yomahub.liteflow.test.component.EComponent"/>
|
||||
<node id="f" class="com.yomahub.liteflow.test.component.FComponent"/>
|
||||
<node id="g" class="com.yomahub.liteflow.test.component.GComponent"/>
|
||||
<node id="cond" class="com.yomahub.liteflow.test.component.CondComponent"/>
|
||||
</nodes>
|
||||
-->
|
||||
|
||||
<chain name="chain1">
|
||||
<then value="a,cond(b|d)"/> <!-- cond是条件节点,根据cond里的逻辑决定路由到b节点还是d节点,可以配置多个 -->
|
||||
<then value="e,f,g"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain2">
|
||||
<then value="a,c"/> <!-- then表示串行 -->
|
||||
<when value="b,d,e,f,g"/> <!-- when表示串行 -->
|
||||
<then value="c"/>
|
||||
</chain>
|
||||
|
||||
<chain name="chain3">
|
||||
<then value="a,c,strategy1,g"/>
|
||||
</chain>
|
||||
|
||||
<chain name="strategy1">
|
||||
<then value="m(m1|m2|strategy2)"/>
|
||||
</chain>
|
||||
|
||||
<chain name="strategy2">
|
||||
<then value="q,p(p1|p2)"/>
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -1,46 +0,0 @@
|
||||
flow:
|
||||
nodes:
|
||||
node:
|
||||
- id: a
|
||||
class: com.yomahub.liteflow.test.component.AComponent
|
||||
- id: b
|
||||
class: com.yomahub.liteflow.test.component.BComponent
|
||||
- id: c
|
||||
class: com.yomahub.liteflow.test.component.CComponent
|
||||
- id: d
|
||||
class: com.yomahub.liteflow.test.component.DComponent
|
||||
- id: e
|
||||
class: com.yomahub.liteflow.test.component.EComponent
|
||||
- id: f
|
||||
class: com.yomahub.liteflow.test.component.FComponent
|
||||
- id: g
|
||||
class: com.yomahub.liteflow.test.component.GComponent
|
||||
- id: cond
|
||||
class: com.yomahub.liteflow.test.component.CondComponent
|
||||
chain:
|
||||
- name: chain1
|
||||
condition:
|
||||
- type: then
|
||||
value: 'a,cond(b|d)'
|
||||
- type: then
|
||||
value: 'e,f,g'
|
||||
- name: chain2
|
||||
condition:
|
||||
- type: then
|
||||
value: 'a,c'
|
||||
- type: when
|
||||
value: 'b,d,e,f,g'
|
||||
- type: then
|
||||
value: 'c'
|
||||
- name: chain3
|
||||
condition:
|
||||
- type: then
|
||||
value: 'a,c,strategy1,g'
|
||||
- name: strategy1
|
||||
condition:
|
||||
- type: then
|
||||
value: m(m1|m2|strategy2)
|
||||
- name: strategy2
|
||||
condition:
|
||||
- type: then
|
||||
value: 'q,p(p1|p2)'
|
||||
Reference in New Issue
Block a user