mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
merge
This commit is contained in:
@@ -72,19 +72,21 @@ public class FlowExecutor {
|
|||||||
for (String path : rulePath) {
|
for (String path : rulePath) {
|
||||||
try {
|
try {
|
||||||
FlowParserTypeEnum pattern = matchFormatConfig(path);
|
FlowParserTypeEnum pattern = matchFormatConfig(path);
|
||||||
path = ReUtil.replaceAll(path, PREFIX_FORMATE_CONFIG_REGEX, "");
|
if(ObjectUtil.isNotNull(pattern)) {
|
||||||
switch (pattern) {
|
path = ReUtil.replaceAll(path, PREFIX_FORMATE_CONFIG_REGEX, "");
|
||||||
case TYPE_XML:
|
switch (pattern) {
|
||||||
parser = matchFormatParser(path, FlowParserTypeEnum.TYPE_XML);
|
case TYPE_XML:
|
||||||
break;
|
parser = matchFormatParser(path, FlowParserTypeEnum.TYPE_XML);
|
||||||
case TYPE_JSON:
|
break;
|
||||||
parser = matchFormatParser(path, FlowParserTypeEnum.TYPE_JSON);
|
case TYPE_JSON:
|
||||||
break;
|
parser = matchFormatParser(path, FlowParserTypeEnum.TYPE_JSON);
|
||||||
case TYPE_YML:
|
break;
|
||||||
parser = matchFormatParser(path, FlowParserTypeEnum.TYPE_YML);
|
case TYPE_YML:
|
||||||
break;
|
parser = matchFormatParser(path, FlowParserTypeEnum.TYPE_YML);
|
||||||
default:
|
break;
|
||||||
LOG.error("can't surport the format {}", path);
|
default:
|
||||||
|
LOG.error("can't surport the format {}", path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isNotNull(parser)) {
|
if(ObjectUtil.isNotNull(parser)) {
|
||||||
parser.parseMain(path);
|
parser.parseMain(path);
|
||||||
@@ -183,6 +185,19 @@ public class FlowExecutor {
|
|||||||
return FlowParserTypeEnum.TYPE_JSON;
|
return FlowParserTypeEnum.TYPE_JSON;
|
||||||
} else if(ReUtil.isMatch(LOCAL_YML_CONFIG_REGEX, path) || ReUtil.isMatch(FORMATE_YML_CONFIG_REGEX, path)) {
|
} else if(ReUtil.isMatch(LOCAL_YML_CONFIG_REGEX, path) || ReUtil.isMatch(FORMATE_YML_CONFIG_REGEX, path)) {
|
||||||
return FlowParserTypeEnum.TYPE_YML;
|
return FlowParserTypeEnum.TYPE_YML;
|
||||||
|
} else if(isClassConfig(path)) {
|
||||||
|
try {
|
||||||
|
Class clazz = Class.forName(path);
|
||||||
|
if(ClassXmlFlowParser.class.isAssignableFrom(clazz)) {
|
||||||
|
return FlowParserTypeEnum.TYPE_XML;
|
||||||
|
} else if(ClassJsonFlowParser.class.isAssignableFrom(clazz)) {
|
||||||
|
return FlowParserTypeEnum.TYPE_JSON;
|
||||||
|
} else if(ClassYmlFlowParser.class.isAssignableFrom(clazz)) {
|
||||||
|
return FlowParserTypeEnum.TYPE_YML;
|
||||||
|
}
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
LOG.error(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class TestFlow implements CommandLineRunner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) throws Exception {
|
public void run(String... args) throws Exception {
|
||||||
LiteflowResponse response= flowExecutor.execute("chain1", "it's a request");
|
LiteflowResponse response= flowExecutor.execute("chain4", "it's a request");
|
||||||
System.out.println(response);
|
System.out.println(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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,6 +1,6 @@
|
|||||||
#liteflow.rule-source=config/flow.xml
|
#liteflow.rule-source=config/flow.xml
|
||||||
#liteflow.rule-source=config/flow.yml
|
#liteflow.rule-source=config/flow.yml
|
||||||
liteflow.rule-source=config/flow.json
|
liteflow.rule-source=config/flow.json;com.yomahub.flowtest.custom.CustomXmlClass
|
||||||
#liteflow.slot-size=2048
|
#liteflow.slot-size=2048
|
||||||
liteflow.when-max-wait-seconds=20
|
liteflow.when-max-wait-seconds=20
|
||||||
liteflow.monitor.enable-log=true
|
liteflow.monitor.enable-log=true
|
||||||
|
|||||||
Reference in New Issue
Block a user