初步完成 liteflow-solon-plugin 适配
This commit is contained in:
parent
e579540e3a
commit
c4c7487563
|
@ -1,10 +1,10 @@
|
|||
package com.yomahub.liteflow.solon.config;
|
||||
|
||||
import com.yomahub.liteflow.monitor.MonitorBus;
|
||||
import com.yomahub.liteflow.property.LiteflowConfig;
|
||||
import com.yomahub.liteflow.solon.LiteflowMonitorProperty;
|
||||
import com.yomahub.liteflow.solon.LiteflowProperty;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
import org.noear.solon.annotation.Configuration;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
/**
|
||||
* LiteflowConfig的装配类
|
||||
|
@ -16,7 +16,10 @@ import org.noear.solon.annotation.Configuration;
|
|||
* @since 2.9
|
||||
*/
|
||||
@Configuration
|
||||
public class LiteflowPropertyAutoConfiguration {
|
||||
public class LiteflowAutoConfiguration {
|
||||
|
||||
@Inject(value = "${liteflow.monitor.enableLog}", required = false)
|
||||
boolean enableLog;
|
||||
|
||||
@Bean
|
||||
public LiteflowConfig liteflowConfig(LiteflowProperty property, LiteflowMonitorProperty liteflowMonitorProperty){
|
||||
|
@ -45,4 +48,13 @@ public class LiteflowPropertyAutoConfiguration {
|
|||
liteflowConfig.setSubstituteCmpClass(property.getSubstituteCmpClass());
|
||||
return liteflowConfig;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MonitorBus monitorBus(LiteflowConfig liteflowConfig) {
|
||||
if (enableLog) {
|
||||
return new MonitorBus(liteflowConfig);
|
||||
} else {
|
||||
return null; //null 即是没创建
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,9 +24,6 @@ public class LiteflowMainAutoConfiguration {
|
|||
@Inject(value = "${liteflow.parseOnStart}",required = false)
|
||||
boolean parseOnStart;
|
||||
|
||||
@Inject(value = "${liteflow.monitor.enableLog}", required = false)
|
||||
boolean enableLog;
|
||||
|
||||
@Inject
|
||||
AopContext aopContext;
|
||||
|
||||
|
@ -44,14 +41,4 @@ public class LiteflowMainAutoConfiguration {
|
|||
|
||||
return flowExecutor;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public MonitorBus monitorBus(LiteflowConfig liteflowConfig) {
|
||||
if (enableLog) {
|
||||
return new MonitorBus(liteflowConfig);
|
||||
} else {
|
||||
return null; //null 即是没创建
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.yomahub.liteflow.solon;
|
||||
package com.yomahub.liteflow.solon.config;
|
||||
|
||||
|
||||
import org.noear.solon.annotation.Configuration;
|
|
@ -1,4 +1,4 @@
|
|||
package com.yomahub.liteflow.solon;
|
||||
package com.yomahub.liteflow.solon.config;
|
||||
|
||||
|
||||
import org.noear.solon.Utils;
|
|
@ -4,8 +4,11 @@ import com.yomahub.liteflow.annotation.LiteflowComponent;
|
|||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import com.yomahub.liteflow.solon.LiteflowProperty;
|
||||
import com.yomahub.liteflow.solon.NodeComponentOfMethod;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowAutoConfiguration;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowMainAutoConfiguration;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowMonitorProperty;
|
||||
import com.yomahub.liteflow.solon.config.LiteflowProperty;
|
||||
import org.noear.solon.Utils;
|
||||
import org.noear.solon.core.AopContext;
|
||||
import org.noear.solon.core.Plugin;
|
||||
|
@ -34,6 +37,11 @@ public class XPluginImpl implements Plugin {
|
|||
return;
|
||||
}
|
||||
|
||||
//放到前面
|
||||
context.beanMake(LiteflowProperty.class);
|
||||
context.beanMake(LiteflowMonitorProperty.class);
|
||||
context.beanMake(LiteflowAutoConfiguration.class);
|
||||
|
||||
//订阅 NodeComponent 组件
|
||||
context.subWrapsOfType(NodeComponent.class, bw -> {
|
||||
NodeComponent node1 = bw.raw();
|
||||
|
@ -65,9 +73,10 @@ public class XPluginImpl implements Plugin {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
//扫描相关组件
|
||||
context.beanOnloaded((ctx)->{
|
||||
context.beanScan(LiteflowProperty.class);
|
||||
context.beanMake(LiteflowMainAutoConfiguration.class);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class LiteflowRetryELSpringbootTest extends BaseTest {
|
|||
Assert.assertEquals("a==>b==>b==>b", response.getExecuteStepStr());
|
||||
}
|
||||
|
||||
|
||||
//单个组件重试配置测试
|
||||
@Test
|
||||
public void testRetry2() {
|
||||
|
|
Loading…
Reference in New Issue