mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-06-10 03:07:32 +08:00
更改package成com.yomahub
This commit is contained in:
@@ -4,7 +4,7 @@ liteflow需要你的项目使用maven
|
||||
## 1.1依赖
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.thebeastshop.liteflow</groupId>
|
||||
<groupId>com.yomahub.liteflow</groupId>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<version>${liteFlow.version}</version>
|
||||
</dependency>
|
||||
@@ -19,11 +19,11 @@ liteflow需要你的项目使用maven
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<nodes>
|
||||
<node id="a" class="com.thebeastshop.liteflow.test.component.AComponent"/>
|
||||
<node id="b" class="com.thebeastshop.liteflow.test.component.BComponent"/>
|
||||
<node id="c" class="com.thebeastshop.liteflow.test.component.CComponent"/>
|
||||
<node id="d" class="com.thebeastshop.liteflow.test.component.DComponent"/>
|
||||
<node id="e" class="com.thebeastshop.liteflow.test.component.EComponent"/>
|
||||
<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"/>
|
||||
</nodes>
|
||||
|
||||
<chain name="demoChain">
|
||||
@@ -74,8 +74,8 @@ Slot slot = executor.execute("demoChain", "arg");
|
||||
## 2.1流程配置可以省略的部分
|
||||
流程配置中的`nodes`节点,可以不用配置了,支持spring的自动扫描方式。你需要在你的spring配置文件中定义
|
||||
```xml
|
||||
<context:component-scan base-package="com.thebeastshop.liteflow.test.component" />
|
||||
<bean class="com.thebeastshop.liteflow.spring.ComponentScaner"/>
|
||||
<context:component-scan base-package="com.yomahub.liteflow.test.component" />
|
||||
<bean class="ComponentScaner"/>
|
||||
```
|
||||
|
||||
当然,你的组件节点也需要注册进spirng容器
|
||||
@@ -93,7 +93,7 @@ public class AComponent extends NodeComponent
|
||||
|
||||
## 2.2spring中执行器的配置
|
||||
```xml
|
||||
<bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<bean id="flowExecutor" class="FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>/config/flow.xml</value>
|
||||
@@ -111,7 +111,7 @@ liteFlow提供了liteflow-spring-boot-starter依赖包
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
@@ -138,7 +138,7 @@ liteFlow支持把配置放在zk集群中,并支持实时修改流程
|
||||
|
||||
```xml
|
||||
<!-- 这种是zk方式配置 -->
|
||||
<bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<bean id="flowExecutor" class="FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183</value>
|
||||
@@ -175,10 +175,10 @@ public class TestCustomParser extends ClassXmlFlowParser {
|
||||
|
||||
spring中需要改的地方还是执行器的配置,只需要在配置的路径地方放入自定义类的类路径即可
|
||||
```xml
|
||||
<bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<bean id="flowExecutor" class="FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>com.thebeastshop.liteflow.test.TestCustomParser</value>
|
||||
<value>com.yomahub.liteflow.test.TestCustomParser</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?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">
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-7-31
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.core;
|
||||
package com.yomahub.liteflow.core;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
@@ -20,24 +20,21 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.thebeastshop.liteflow.entity.config.Chain;
|
||||
import com.thebeastshop.liteflow.entity.config.Condition;
|
||||
import com.thebeastshop.liteflow.entity.config.Node;
|
||||
import com.thebeastshop.liteflow.entity.config.ThenCondition;
|
||||
import com.thebeastshop.liteflow.entity.config.WhenCondition;
|
||||
import com.thebeastshop.liteflow.entity.data.DataBus;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
import com.thebeastshop.liteflow.exception.ChainNotFoundException;
|
||||
import com.thebeastshop.liteflow.exception.FlowExecutorNotInitException;
|
||||
import com.thebeastshop.liteflow.exception.FlowSystemException;
|
||||
import com.thebeastshop.liteflow.exception.NoAvailableSlotException;
|
||||
import com.thebeastshop.liteflow.exception.ParseException;
|
||||
import com.thebeastshop.liteflow.flow.FlowBus;
|
||||
import com.thebeastshop.liteflow.parser.LocalXmlFlowParser;
|
||||
import com.thebeastshop.liteflow.parser.XmlFlowParser;
|
||||
import com.thebeastshop.liteflow.parser.ZookeeperXmlFlowParser;
|
||||
import com.thebeastshop.liteflow.util.LOGOPrinter;
|
||||
import com.yomahub.liteflow.entity.config.Chain;
|
||||
import com.yomahub.liteflow.entity.config.Condition;
|
||||
import com.yomahub.liteflow.entity.config.Node;
|
||||
import com.yomahub.liteflow.entity.config.ThenCondition;
|
||||
import com.yomahub.liteflow.entity.config.WhenCondition;
|
||||
import com.yomahub.liteflow.entity.data.DataBus;
|
||||
import com.yomahub.liteflow.entity.data.DefaultSlot;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import com.yomahub.liteflow.exception.ChainNotFoundException;
|
||||
import com.yomahub.liteflow.exception.FlowExecutorNotInitException;
|
||||
import com.yomahub.liteflow.exception.NoAvailableSlotException;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.parser.LocalXmlFlowParser;
|
||||
import com.yomahub.liteflow.parser.XmlFlowParser;
|
||||
import com.yomahub.liteflow.parser.ZookeeperXmlFlowParser;
|
||||
|
||||
public class FlowExecutor {
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.core;
|
||||
package com.yomahub.liteflow.core;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.StopWatch;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.thebeastshop.liteflow.entity.config.Node;
|
||||
import com.thebeastshop.liteflow.entity.data.CmpStep;
|
||||
import com.thebeastshop.liteflow.entity.data.CmpStepType;
|
||||
import com.thebeastshop.liteflow.entity.data.DataBus;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
import com.thebeastshop.liteflow.entity.monitor.CompStatistics;
|
||||
import com.thebeastshop.liteflow.flow.FlowBus;
|
||||
import com.thebeastshop.liteflow.monitor.MonitorBus;
|
||||
import com.yomahub.liteflow.entity.config.Node;
|
||||
import com.yomahub.liteflow.entity.data.CmpStep;
|
||||
import com.yomahub.liteflow.entity.data.CmpStepType;
|
||||
import com.yomahub.liteflow.entity.data.DataBus;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import com.yomahub.liteflow.entity.monitor.CompStatistics;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.monitor.MonitorBus;
|
||||
|
||||
public abstract class NodeComponent {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.core;
|
||||
package com.yomahub.liteflow.core;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -20,7 +20,7 @@ public abstract class NodeCondComponent extends NodeComponent {
|
||||
String nodeId = component.value();
|
||||
this.getSlot().setCondResult(this.getClass().getName(), nodeId);
|
||||
}
|
||||
|
||||
|
||||
protected abstract Class<? extends NodeComponent> processCond() throws Exception;
|
||||
|
||||
}
|
||||
@@ -7,16 +7,16 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.config;
|
||||
package com.yomahub.liteflow.entity.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Chain {
|
||||
|
||||
|
||||
private String chainName;
|
||||
|
||||
|
||||
private List<Condition> conditionList;
|
||||
|
||||
|
||||
public Chain(String chainName, List<Condition> conditionList) {
|
||||
this.chainName = chainName;
|
||||
this.conditionList = conditionList;
|
||||
@@ -7,14 +7,14 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.config;
|
||||
package com.yomahub.liteflow.entity.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Condition {
|
||||
|
||||
|
||||
private List<Node> nodeList;
|
||||
|
||||
|
||||
public Condition(List<Node> nodeList) {
|
||||
this.nodeList = nodeList;
|
||||
}
|
||||
@@ -7,27 +7,27 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.config;
|
||||
package com.yomahub.liteflow.entity.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
public class Node {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String clazz;
|
||||
|
||||
|
||||
private NodeComponent instance;
|
||||
|
||||
|
||||
private Map<String, Node> condNodeMap = new HashMap<String, Node>();
|
||||
|
||||
|
||||
public Node(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Node(String id, String clazz, NodeComponent instance) {
|
||||
this.id = id;
|
||||
this.clazz = clazz;
|
||||
@@ -57,11 +57,11 @@ public class Node {
|
||||
public void setInstance(NodeComponent instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
|
||||
public Node getCondNode(String nodeId){
|
||||
return this.condNodeMap.get(nodeId);
|
||||
}
|
||||
|
||||
|
||||
public void setCondNode(String nodeId, Node condNode){
|
||||
this.condNodeMap.put(nodeId, condNode);
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.config;
|
||||
package com.yomahub.liteflow.entity.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.config;
|
||||
package com.yomahub.liteflow.entity.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
* @Date 2017-8-3
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.data;
|
||||
package com.yomahub.liteflow.entity.data;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -21,93 +19,93 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class AbsSlot implements Slot{
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Slot.class);
|
||||
|
||||
|
||||
private final String REQUEST = "request";
|
||||
|
||||
|
||||
private final String RESPONSE = "response";
|
||||
|
||||
|
||||
private final String CHAINNAME = "chain_name";
|
||||
|
||||
|
||||
private final String COND_NODE_PREFIX = "cond_";
|
||||
|
||||
|
||||
private final String NODE_INPUT_PREFIX = "input_";
|
||||
|
||||
|
||||
private final String NODE_OUTPUT_PREFIX = "output_";
|
||||
|
||||
|
||||
private final String CHAIN_REQ_PREFIX = "chain_req_";
|
||||
|
||||
|
||||
private final String REQUEST_ID = "req_id";
|
||||
|
||||
|
||||
private Deque<CmpStep> executeSteps = new ArrayDeque<CmpStep>();
|
||||
|
||||
|
||||
protected ConcurrentHashMap<String, Object> dataMap = new ConcurrentHashMap<String, Object>();
|
||||
|
||||
|
||||
public <T> T getInput(String nodeId){
|
||||
return (T)dataMap.get(NODE_INPUT_PREFIX + nodeId);
|
||||
}
|
||||
|
||||
|
||||
public <T> T getOutput(String nodeId){
|
||||
return (T)dataMap.get(NODE_OUTPUT_PREFIX + nodeId);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setInput(String nodeId,T t){
|
||||
dataMap.put(NODE_INPUT_PREFIX + nodeId, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setOutput(String nodeId,T t){
|
||||
dataMap.put(NODE_OUTPUT_PREFIX + nodeId, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> T getRequestData(){
|
||||
return (T)dataMap.get(REQUEST);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setRequestData(T t){
|
||||
dataMap.put(REQUEST, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> T getResponseData(){
|
||||
return (T)dataMap.get(RESPONSE);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setResponseData(T t){
|
||||
dataMap.put(RESPONSE, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> T getChainReqData(String chainId) {
|
||||
return (T)dataMap.get(CHAIN_REQ_PREFIX + chainId);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setChainReqData(String chainId, T t) {
|
||||
dataMap.put(CHAIN_REQ_PREFIX + chainId, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> T getData(String key){
|
||||
return (T)dataMap.get(key);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setData(String key, T t){
|
||||
dataMap.put(key, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setCondResult(String key, T t){
|
||||
dataMap.put(COND_NODE_PREFIX + key, t);
|
||||
}
|
||||
|
||||
|
||||
public <T> T getCondResult(String key){
|
||||
return (T)dataMap.get(COND_NODE_PREFIX + key);
|
||||
}
|
||||
|
||||
|
||||
public void setChainName(String chainName) {
|
||||
dataMap.put(CHAINNAME, chainName);
|
||||
}
|
||||
|
||||
|
||||
public String getChainName() {
|
||||
return (String)dataMap.get(CHAINNAME);
|
||||
}
|
||||
|
||||
|
||||
public void addStep(CmpStep step){
|
||||
CmpStep lastStep = this.executeSteps.peekLast();
|
||||
if(lastStep != null && lastStep.equals(step)) {
|
||||
@@ -116,7 +114,7 @@ public abstract class AbsSlot implements Slot{
|
||||
this.executeSteps.add(step);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void printStep(){
|
||||
StringBuffer str = new StringBuffer();
|
||||
CmpStep cmpStep = null;
|
||||
@@ -129,12 +127,12 @@ public abstract class AbsSlot implements Slot{
|
||||
}
|
||||
LOG.info("[{}]:CHAIN_NAME[{}]\n{}",getRequestId(),this.getChainName(),str.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void generateRequestId() {
|
||||
dataMap.put(REQUEST_ID, new Long(System.nanoTime()).toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRequestId() {
|
||||
return (String)dataMap.get(REQUEST_ID);
|
||||
@@ -7,15 +7,15 @@
|
||||
* @Date 2017-12-8
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.data;
|
||||
package com.yomahub.liteflow.entity.data;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class CmpStep {
|
||||
private String nodeId;
|
||||
|
||||
|
||||
private CmpStepType stepType;
|
||||
|
||||
|
||||
public CmpStep(String nodeId, CmpStepType stepType) {
|
||||
this.nodeId = nodeId;
|
||||
this.stepType = stepType;
|
||||
@@ -36,7 +36,7 @@ public class CmpStep {
|
||||
public void setStepType(CmpStepType stepType) {
|
||||
this.stepType = stepType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if(stepType.equals(CmpStepType.SINGLE)) {
|
||||
@@ -44,10 +44,10 @@ public class CmpStep {
|
||||
}else {
|
||||
return MessageFormat.format("{0}({1})", nodeId,stepType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-12-8
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.data;
|
||||
package com.yomahub.liteflow.entity.data;
|
||||
|
||||
public enum CmpStepType {
|
||||
START,
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.data;
|
||||
package com.yomahub.liteflow.entity.data;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@@ -15,15 +15,15 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DataBus {
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DataBus.class);
|
||||
|
||||
|
||||
public static final int SLOT_SIZE = 1024;
|
||||
|
||||
|
||||
public static AtomicInteger OCCUPY_COUNT = new AtomicInteger(0);
|
||||
|
||||
|
||||
private static Slot[] slots = new Slot[SLOT_SIZE];
|
||||
|
||||
|
||||
public synchronized static int offerSlot(Class<? extends Slot> slotClazz){
|
||||
try{
|
||||
for(int i = 0; i < slots.length; i++){
|
||||
@@ -39,12 +39,12 @@ public class DataBus {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Slot> T getSlot(int slotIndex){
|
||||
return (T)slots[slotIndex];
|
||||
}
|
||||
|
||||
|
||||
public static void releaseSlot(int slotIndex){
|
||||
if(slots[slotIndex] != null){
|
||||
LOG.info("[{}]:slot[{}] released",slots[slotIndex].getRequestId(),slotIndex);
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-12-4
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.data;
|
||||
package com.yomahub.liteflow.entity.data;
|
||||
|
||||
public class DefaultSlot extends AbsSlot {
|
||||
|
||||
@@ -7,46 +7,46 @@
|
||||
* @Date 2017-12-4
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.data;
|
||||
package com.yomahub.liteflow.entity.data;
|
||||
|
||||
public interface Slot {
|
||||
public <T> T getInput(String nodeId);
|
||||
|
||||
|
||||
public <T> T getOutput(String nodeId);
|
||||
|
||||
|
||||
public <T> void setInput(String nodeId,T t);
|
||||
|
||||
|
||||
public <T> void setOutput(String nodeId,T t);
|
||||
|
||||
|
||||
public <T> T getRequestData();
|
||||
|
||||
|
||||
public <T> void setRequestData(T t);
|
||||
|
||||
|
||||
public <T> T getResponseData();
|
||||
|
||||
|
||||
public <T> void setChainReqData(String chainId, T t);
|
||||
|
||||
|
||||
public <T> T getChainReqData(String chainId);
|
||||
|
||||
|
||||
public <T> void setResponseData(T t);
|
||||
|
||||
|
||||
public <T> T getData(String key);
|
||||
|
||||
|
||||
public <T> void setData(String key, T t);
|
||||
|
||||
|
||||
public <T> void setCondResult(String key, T t);
|
||||
|
||||
|
||||
public <T> T getCondResult(String key);
|
||||
|
||||
|
||||
public void addStep(CmpStep step);
|
||||
|
||||
|
||||
public void printStep();
|
||||
|
||||
|
||||
public void generateRequestId();
|
||||
|
||||
|
||||
public String getRequestId();
|
||||
|
||||
|
||||
public void setChainName(String chainName);
|
||||
|
||||
|
||||
public String getChainName();
|
||||
}
|
||||
@@ -7,14 +7,14 @@
|
||||
* @Date 2017-8-4
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.entity.monitor;
|
||||
package com.yomahub.liteflow.entity.monitor;
|
||||
|
||||
public class CompStatistics {
|
||||
|
||||
|
||||
private String componentClazzName;
|
||||
|
||||
|
||||
private long timeSpent;
|
||||
|
||||
|
||||
private long memorySpent;
|
||||
|
||||
public String getComponentClazzName() {
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.thebeastshop.liteflow.exception;
|
||||
package com.yomahub.liteflow.exception;
|
||||
|
||||
public class ChainNotFoundException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 异常信息 */
|
||||
private String message;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.thebeastshop.liteflow.exception;
|
||||
package com.yomahub.liteflow.exception;
|
||||
|
||||
public class ComponentNotAccessException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 异常信息 */
|
||||
private String message;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.thebeastshop.liteflow.exception;
|
||||
package com.yomahub.liteflow.exception;
|
||||
|
||||
public class FlowExecutorNotInitException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 异常信息 */
|
||||
private String message;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.thebeastshop.liteflow.exception;
|
||||
package com.yomahub.liteflow.exception;
|
||||
|
||||
public class FlowSystemException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 异常信息 */
|
||||
private String message;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.thebeastshop.liteflow.exception;
|
||||
package com.yomahub.liteflow.exception;
|
||||
|
||||
public class NoAvailableSlotException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 异常信息 */
|
||||
private String message;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.thebeastshop.liteflow.exception;
|
||||
package com.yomahub.liteflow.exception;
|
||||
|
||||
public class ParseException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 异常信息 */
|
||||
private String message;
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.flow;
|
||||
package com.yomahub.liteflow.flow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
|
||||
import com.thebeastshop.liteflow.entity.config.Chain;
|
||||
import com.thebeastshop.liteflow.entity.config.Node;
|
||||
import com.yomahub.liteflow.entity.config.Chain;
|
||||
import com.yomahub.liteflow.entity.config.Node;
|
||||
|
||||
public class FlowBus {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-8-4
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.monitor;
|
||||
package com.yomahub.liteflow.monitor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -23,13 +23,12 @@ import java.util.Map.Entry;
|
||||
import java.util.Timer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.thebeastshop.liteflow.entity.data.DataBus;
|
||||
import com.thebeastshop.liteflow.entity.monitor.CompStatistics;
|
||||
import com.thebeastshop.liteflow.util.LimitQueue;
|
||||
import com.yomahub.liteflow.entity.data.DataBus;
|
||||
import com.yomahub.liteflow.entity.monitor.CompStatistics;
|
||||
import com.yomahub.liteflow.util.LimitQueue;
|
||||
|
||||
public class MonitorBus {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.liteflow.parser;
|
||||
package com.yomahub.liteflow.parser;
|
||||
|
||||
public abstract class ClassXmlFlowParser extends XmlFlowParser {
|
||||
@Override
|
||||
@@ -6,6 +6,6 @@ public abstract class ClassXmlFlowParser extends XmlFlowParser {
|
||||
String content = parseCustom();
|
||||
parse(content);
|
||||
}
|
||||
|
||||
|
||||
public abstract String parseCustom();
|
||||
}
|
||||
@@ -7,14 +7,14 @@
|
||||
* @Date 2017-7-28
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.parser;
|
||||
package com.yomahub.liteflow.parser;
|
||||
|
||||
import com.thebeastshop.liteflow.util.IOUtil;
|
||||
import com.yomahub.liteflow.util.IOUtil;
|
||||
|
||||
public class LocalXmlFlowParser extends XmlFlowParser{
|
||||
|
||||
private final String ENCODING_FORMAT = "UTF-8";
|
||||
|
||||
|
||||
public void parseMain(String rulePath) throws Exception {
|
||||
String ruleContent = IOUtil.read(rulePath, ENCODING_FORMAT);
|
||||
parse(ruleContent);
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.thebeastshop.liteflow.parser;
|
||||
package com.yomahub.liteflow.parser;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RegexEntity {
|
||||
|
||||
|
||||
private String condNode;
|
||||
|
||||
|
||||
private String[] realNodeArray;
|
||||
|
||||
public String getCondNode() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.liteflow.parser;
|
||||
package com.yomahub.liteflow.parser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -13,15 +13,15 @@ import org.dom4j.Element;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.config.Chain;
|
||||
import com.thebeastshop.liteflow.entity.config.Condition;
|
||||
import com.thebeastshop.liteflow.entity.config.Node;
|
||||
import com.thebeastshop.liteflow.entity.config.ThenCondition;
|
||||
import com.thebeastshop.liteflow.entity.config.WhenCondition;
|
||||
import com.thebeastshop.liteflow.flow.FlowBus;
|
||||
import com.thebeastshop.liteflow.spring.ComponentScaner;
|
||||
import com.thebeastshop.liteflow.util.Dom4JReader;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.config.Chain;
|
||||
import com.yomahub.liteflow.entity.config.Condition;
|
||||
import com.yomahub.liteflow.entity.config.Node;
|
||||
import com.yomahub.liteflow.entity.config.ThenCondition;
|
||||
import com.yomahub.liteflow.entity.config.WhenCondition;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.spring.ComponentScaner;
|
||||
import com.yomahub.liteflow.util.Dom4JReader;
|
||||
|
||||
public abstract class XmlFlowParser {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.liteflow.parser;
|
||||
package com.yomahub.liteflow.parser;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
@@ -10,18 +10,18 @@ import org.apache.curator.framework.recipes.cache.NodeCacheListener;
|
||||
import org.apache.curator.retry.RetryNTimes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.thebeastshop.liteflow.exception.ParseException;
|
||||
import com.yomahub.liteflow.exception.ParseException;
|
||||
|
||||
public class ZookeeperXmlFlowParser extends XmlFlowParser{
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ZookeeperXmlFlowParser.class);
|
||||
|
||||
|
||||
private String nodePath = "/lite-flow/flow";
|
||||
|
||||
|
||||
public ZookeeperXmlFlowParser() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ZookeeperXmlFlowParser(String node) {
|
||||
nodePath = node;
|
||||
}
|
||||
@@ -33,21 +33,21 @@ public class ZookeeperXmlFlowParser extends XmlFlowParser{
|
||||
new RetryNTimes(10, 5000)
|
||||
);
|
||||
client.start();
|
||||
|
||||
|
||||
if (client.checkExists().forPath(nodePath) == null) {
|
||||
client.create().creatingParentsIfNeeded().forPath(nodePath, "".getBytes());
|
||||
}
|
||||
|
||||
|
||||
String content = new String(client.getData().forPath(nodePath));
|
||||
|
||||
|
||||
|
||||
|
||||
if(StringUtils.isBlank(content)) {
|
||||
String error = MessageFormat.format("the node[{0}] value is empty", nodePath);
|
||||
throw new ParseException(error);
|
||||
}
|
||||
parse(content);
|
||||
|
||||
|
||||
|
||||
|
||||
final NodeCache cache = new NodeCache(client,nodePath);
|
||||
cache.start();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-11-23
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.spring;
|
||||
package com.yomahub.liteflow.spring;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -17,9 +17,8 @@ import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.PriorityOrdered;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.config.Node;
|
||||
import com.thebeastshop.liteflow.util.LOGOPrinter;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.util.LOGOPrinter;
|
||||
|
||||
public class ComponentScaner implements BeanPostProcessor, PriorityOrdered {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.liteflow.util;
|
||||
package com.yomahub.liteflow.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -16,9 +16,9 @@ import org.dom4j.io.SAXReader;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
public class Dom4JReader {
|
||||
|
||||
|
||||
private static final String ENCODING_FORMAT = "UTF-8";
|
||||
|
||||
|
||||
public static Document getDocument(String text) throws DocumentException {
|
||||
return DocumentHelper.parseText(text);
|
||||
}
|
||||
@@ -114,4 +114,4 @@ public class Dom4JReader {
|
||||
|
||||
return saxReader.read(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.liteflow.util;
|
||||
package com.yomahub.liteflow.util;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
@@ -26,4 +26,4 @@ public class IOUtil {
|
||||
|
||||
return content;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.thebeastshop.liteflow.util;
|
||||
package com.yomahub.liteflow.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LOGOPrinter {
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LOGOPrinter.class);
|
||||
|
||||
|
||||
public static void print() {
|
||||
StringBuilder str = new StringBuilder("\n");
|
||||
str.append("================================================================================================\n");
|
||||
@@ -7,7 +7,7 @@
|
||||
* @Date 2017-8-4
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.util;
|
||||
package com.yomahub.liteflow.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-7-27
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
|
||||
/**
|
||||
* 这是编程式引用liteflow
|
||||
*/
|
||||
public class TestMain {
|
||||
public static void main(String[] args) throws Exception {
|
||||
final FlowExecutor executor = new FlowExecutor();
|
||||
executor.setRulePath(Arrays.asList(new String[]{"config/flow.xml"}));
|
||||
executor.init();
|
||||
|
||||
Slot slot = executor.execute("chain1", "it's a request");
|
||||
System.out.println(slot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.thebeastshop.liteflow.test;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
|
||||
|
||||
/**
|
||||
* 此示例演示了如何在spring中用liteflow
|
||||
* 如果是springboot请参考flowtest
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "classpath:spring-test.xml" })
|
||||
public class TestWithSpringMain {
|
||||
|
||||
@Resource(name="flowExecutor")
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Test
|
||||
public void test1() throws Exception {
|
||||
Slot slot = flowExecutor.execute("chain1", "it's a request");
|
||||
System.out.println(slot);
|
||||
System.out.println("done!");
|
||||
System.in.read();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() throws Exception {
|
||||
try {
|
||||
Slot slot = flowExecutor.execute("chain3", "it's a request");
|
||||
System.out.println(slot);
|
||||
System.in.read();
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test3() throws Exception {
|
||||
try {
|
||||
while(true) {
|
||||
Slot slot = flowExecutor.execute("chain3", "it's a request");
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@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,31 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@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,31 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@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();
|
||||
}
|
||||
System.out.println("Ccomponent executed!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +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.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
|
||||
@Component("cond")
|
||||
public class CondComponent extends NodeCondComponent {
|
||||
|
||||
@Override
|
||||
protected Class<? extends NodeComponent> processCond() throws Exception {
|
||||
return BComponent.class;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
|
||||
@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,32 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@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,31 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@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,25 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("g")
|
||||
public class GComponent extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("Gcomponent executed!");
|
||||
this.getSlot().setResponseData("i am a response");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
|
||||
@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,30 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("m1")
|
||||
public class M1Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m1 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("m2")
|
||||
public class M2Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("m2 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
|
||||
@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,40 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
|
||||
@Component("m")
|
||||
public class MComponent extends NodeCondComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
protected Class<? extends NodeComponent> processCond() throws Exception {
|
||||
System.out.println("m conponent executed");
|
||||
Integer flag = this.getSlot().getChainReqData("strategy1");
|
||||
if(flag == 1) {
|
||||
return M1Component.class;
|
||||
}else if(flag == 2){
|
||||
return M2Component.class;
|
||||
}else {
|
||||
return M3Component.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("p1")
|
||||
public class P1Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("p1 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
|
||||
@Component("p2")
|
||||
public class P2Component extends NodeComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
System.out.println("p2 component executed!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* <p>Title: liteFlow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* <p>Copyright: Copyright (c) 2017</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.liteflow.test.component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
|
||||
@Component("p")
|
||||
public class PComponent extends NodeCondComponent {
|
||||
|
||||
@Resource
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Override
|
||||
protected Class<? extends NodeComponent> processCond() throws Exception {
|
||||
System.out.println("p conponent executed");
|
||||
Integer flag = this.getSlot().getChainReqData("strategy2");
|
||||
if(flag == 10) {
|
||||
return P1Component.class;
|
||||
}else {
|
||||
return P2Component.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<!-- 如果和spring集成,以下<nodes>配置可以不要 -->
|
||||
<nodes>
|
||||
<node id="a" class="com.thebeastshop.liteflow.test.component.AComponent"/>
|
||||
<node id="b" class="com.thebeastshop.liteflow.test.component.BComponent"/>
|
||||
<node id="c" class="com.thebeastshop.liteflow.test.component.CComponent"/>
|
||||
<node id="d" class="com.thebeastshop.liteflow.test.component.DComponent"/>
|
||||
<node id="e" class="com.thebeastshop.liteflow.test.component.EComponent"/>
|
||||
<node id="f" class="com.thebeastshop.liteflow.test.component.FComponent"/>
|
||||
<node id="g" class="com.thebeastshop.liteflow.test.component.GComponent"/>
|
||||
<node id="cond" class="com.thebeastshop.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,h,g"/>
|
||||
</chain>
|
||||
|
||||
<chain name="strategy1">
|
||||
<then value="m(m1|m2|m3)"/>
|
||||
</chain>
|
||||
|
||||
<chain name="strategy2">
|
||||
<then value="p(p1|p2)"/>
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration>
|
||||
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} [%p] %m >> %c:%L%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<appender name="fileout" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="./logs/commdata.log"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} [%p] %m >> %c:%L%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<appender name="asyncStdout" class="org.apache.log4j.AsyncAppender">
|
||||
<param name="BufferSize" value="8192"/>
|
||||
<appender-ref ref="stdout"/>
|
||||
</appender>
|
||||
<appender name="asyncFileout" class="org.apache.log4j.AsyncAppender">
|
||||
<param name="BufferSize" value="8192"/>
|
||||
<appender-ref ref="fileout"/>
|
||||
</appender>
|
||||
<root>
|
||||
<priority value="info" />
|
||||
<appender-ref ref="asyncStdout"/>
|
||||
<appender-ref ref="asyncFileout"/>
|
||||
</root>
|
||||
</log4j:configuration>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd"
|
||||
default-autowire="byName">
|
||||
|
||||
<context:component-scan base-package="com.thebeastshop.liteflow.test.component" />
|
||||
<bean class="com.thebeastshop.liteflow.spring.ComponentScaner"/>
|
||||
|
||||
<!-- 本地方式配置 -->
|
||||
<bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>config/flow.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- 这种是zk方式配置 -->
|
||||
<!-- <bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>123.206.92.144:2181,123.206.92.144:2182,123.206.92.144:2183</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="zkNode" value="/lite-flow/customFlow"/>这个不配置就用默认的/lite-flow/flow节点
|
||||
</bean> -->
|
||||
|
||||
<!-- 这种是自定义Class方式配置 -->
|
||||
<!-- <bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>com.thebeastshop.liteflow.test.TestCustomParser</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean> -->
|
||||
</beans>
|
||||
@@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.thebeastshop.liteflow.springboot;
|
||||
package com.yomahub.liteflow.springboot;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.spring.ComponentScaner;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.spring.ComponentScaner;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.thebeastshop.liteflow.springboot;
|
||||
package com.yomahub.liteflow.springboot;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.liteflow.springboot;
|
||||
package com.yomahub.liteflow.springboot;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -1,6 +1,6 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.thebeastshop.liteflow.springboot.LiteflowProperty,\
|
||||
com.thebeastshop.liteflow.springboot.LiteflowAutoConfiguration,\
|
||||
com.thebeastshop.liteflow.springboot.LiteflowExecutorInit
|
||||
com.yomahub.liteflow.springboot.LiteflowProperty,\
|
||||
com.yomahub.liteflow.springboot.LiteflowAutoConfiguration,\
|
||||
com.yomahub.liteflow.springboot.LiteflowExecutorInit
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -38,7 +38,7 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-core</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.thebeastshop.flowtest;
|
||||
package com.yomahub.flowtest;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("a")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("b")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("c")
|
||||
@@ -6,10 +6,10 @@
|
||||
* @email 47483522@qq.com
|
||||
* @Date 2017-11-28
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("cond")
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("d")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("e")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("f")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("g")
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
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;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
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;
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
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;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
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;
|
||||
@@ -7,11 +7,11 @@
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
|
||||
|
||||
<context:component-scan base-package="com.thebeastshop.flowtest.components" />
|
||||
<context:component-scan base-package="com.yomahub.flowtest.components" />
|
||||
|
||||
<bean class="com.thebeastshop.liteflow.spring.ComponentScaner" depends-on="flowExecutor"/>
|
||||
<bean class="com.yomahub.liteflow.spring.ComponentScaner" depends-on="flowExecutor"/>
|
||||
|
||||
<bean id="flowExecutor" class="com.thebeastshop.liteflow.core.FlowExecutor">
|
||||
<bean id="flowExecutor" class="com.yomahub.liteflow.core.FlowExecutor">
|
||||
<property name="rulePath">
|
||||
<list>
|
||||
<value>config/flow.xml</value>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
<flow>
|
||||
<!-- 如果和spring集成,以下<nodes>配置可以不要
|
||||
<nodes>
|
||||
<node id="a" class="com.thebeastshop.flowtest.components.AComponent"/>
|
||||
<node id="b" class="com.thebeastshop.flowtest.components.BComponent"/>
|
||||
<node id="c" class="com.thebeastshop.flowtest.components.CComponent"/>
|
||||
<node id="d" class="com.thebeastshop.flowtest.components.DComponent"/>
|
||||
<node id="e" class="com.thebeastshop.flowtest.components.EComponent"/>
|
||||
<node id="f" class="com.thebeastshop.flowtest.components.FComponent"/>
|
||||
<node id="g" class="com.thebeastshop.flowtest.components.GComponent"/>
|
||||
<node id="cond" class="com.thebeastshop.liteflow.test.component.CondComponent"/>
|
||||
<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>
|
||||
-->
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>liteflow</artifactId>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<artifactId>liteflow-test-springboot</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
@@ -36,7 +35,7 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.thebeastshop</groupId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.thebeastshop.flowtest;
|
||||
package com.yomahub.flowtest;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.thebeastshop.flowtest;
|
||||
package com.yomahub.flowtest;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("a")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("b")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("c")
|
||||
@@ -6,10 +6,10 @@
|
||||
* @email 47483522@qq.com
|
||||
* @Date 2017-11-28
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeCondComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("cond")
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.Slot;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("d")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("e")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("f")
|
||||
@@ -7,9 +7,9 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("g")
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
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;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.entity.data.DefaultSlot;
|
||||
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;
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
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;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,10 +7,10 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -7,11 +7,11 @@
|
||||
* @Date 2017-8-1
|
||||
* @version 1.0
|
||||
*/
|
||||
package com.thebeastshop.flowtest.components;
|
||||
package com.yomahub.flowtest.components;
|
||||
|
||||
import com.thebeastshop.liteflow.core.FlowExecutor;
|
||||
import com.thebeastshop.liteflow.core.NodeComponent;
|
||||
import com.thebeastshop.liteflow.core.NodeCondComponent;
|
||||
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;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user