mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-15 04:22:09 +08:00
feature #I3N2E2 支持编程时式的注册组件的方式
This commit is contained in:
@@ -2,6 +2,7 @@ package com.yomahub.liteflow.springboot;
|
||||
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
/**
|
||||
* 执行器初始化类
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.yomahub.liteflow.property.LiteflowConfig;
|
||||
import com.yomahub.liteflow.util.SpringAware;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -35,6 +36,7 @@ public class LiteflowMainAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "liteflow",name = "parse-on-start",havingValue = "true")
|
||||
public LiteflowExecutorInit liteflowExecutorInit(FlowExecutor flowExecutor) {
|
||||
return new LiteflowExecutorInit(flowExecutor);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ public class LiteflowProperty {
|
||||
//异步线程池最大队列数量
|
||||
private int whenQueueLimit;
|
||||
|
||||
//是否在启动时解析规则文件
|
||||
//这个参数主要给编码式注册元数据的场景用的,结合FlowBus.addNode一起用
|
||||
private boolean parseOnStart;
|
||||
|
||||
public String getRuleSource() {
|
||||
return ruleSource;
|
||||
}
|
||||
@@ -63,4 +67,12 @@ public class LiteflowProperty {
|
||||
public void setWhenQueueLimit(int whenQueueLimit) {
|
||||
this.whenQueueLimit = whenQueueLimit;
|
||||
}
|
||||
|
||||
public boolean isParseOnStart() {
|
||||
return parseOnStart;
|
||||
}
|
||||
|
||||
public void setParseOnStart(boolean parseOnStart) {
|
||||
this.parseOnStart = parseOnStart;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public class LiteflowPropertyAutoConfiguration {
|
||||
liteflowConfig.setPeriod(liteflowMonitorProperty.getPeriod());
|
||||
liteflowConfig.setWhenMaxWorkers(property.getWhenMaxWorkers());
|
||||
liteflowConfig.setWhenQueueLimit(property.getWhenQueueLimit());
|
||||
liteflowConfig.setParseOnStart(property.isParseOnStart());
|
||||
return liteflowConfig;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user