optimize liteflow example
This commit is contained in:
parent
484be56a99
commit
515793bea9
|
@ -18,6 +18,8 @@
|
||||||
package org.dromara.dynamictp.example.cmp;
|
package org.dromara.dynamictp.example.cmp;
|
||||||
|
|
||||||
import com.yomahub.liteflow.core.NodeComponent;
|
import com.yomahub.liteflow.core.NodeComponent;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.dynamictp.example.ctx.CusCtx;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,12 +28,14 @@ import org.springframework.stereotype.Component;
|
||||||
* @author yanhom
|
* @author yanhom
|
||||||
* @since 1.1.9
|
* @since 1.1.9
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component("a")
|
@Component("a")
|
||||||
public class ACmp extends NodeComponent {
|
public class ACmp extends NodeComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process() {
|
public void process() {
|
||||||
//do your business
|
CusCtx ctx = this.getFirstContextBean();
|
||||||
|
log.info("a, ctx:{}", ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
package org.dromara.dynamictp.example.cmp;
|
package org.dromara.dynamictp.example.cmp;
|
||||||
|
|
||||||
import com.yomahub.liteflow.core.NodeComponent;
|
import com.yomahub.liteflow.core.NodeComponent;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.dynamictp.example.ctx.CusCtx;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,12 +28,14 @@ import org.springframework.stereotype.Component;
|
||||||
* @author yanhom
|
* @author yanhom
|
||||||
* @since 1.1.9
|
* @since 1.1.9
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component("b")
|
@Component("b")
|
||||||
public class BCmp extends NodeComponent {
|
public class BCmp extends NodeComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process() {
|
public void process() {
|
||||||
//do your business
|
CusCtx ctx = this.getFirstContextBean();
|
||||||
|
log.info("b, ctx:{}", ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
package org.dromara.dynamictp.example.cmp;
|
package org.dromara.dynamictp.example.cmp;
|
||||||
|
|
||||||
import com.yomahub.liteflow.core.NodeComponent;
|
import com.yomahub.liteflow.core.NodeComponent;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.dynamictp.example.ctx.CusCtx;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,12 +28,14 @@ import org.springframework.stereotype.Component;
|
||||||
* @author yanhom
|
* @author yanhom
|
||||||
* @since 1.1.9
|
* @since 1.1.9
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component("c")
|
@Component("c")
|
||||||
public class CCmp extends NodeComponent {
|
public class CCmp extends NodeComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process() {
|
public void process() {
|
||||||
//do your business
|
CusCtx ctx = this.getFirstContextBean();
|
||||||
|
log.info("c, ctx:{}", ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.dromara.dynamictp.example.ctx;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CusCtx related
|
||||||
|
*
|
||||||
|
* @author yanhom
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor(staticName = "of")
|
||||||
|
@Data
|
||||||
|
public class CusCtx {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ package org.dromara.dynamictp.example.service;
|
||||||
import com.yomahub.liteflow.core.FlowExecutor;
|
import com.yomahub.liteflow.core.FlowExecutor;
|
||||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.dynamictp.example.ctx.CusCtx;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -37,8 +38,9 @@ public class BizService {
|
||||||
@Resource
|
@Resource
|
||||||
private FlowExecutor flowExecutor;
|
private FlowExecutor flowExecutor;
|
||||||
|
|
||||||
public void testConfig(){
|
public void testConfig() {
|
||||||
LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg");
|
CusCtx ctx = CusCtx.of(1L, "test");
|
||||||
|
LiteflowResponse response = flowExecutor.execute2Resp("chain1", null, ctx);
|
||||||
log.info("response:{}", response);
|
log.info("response:{}", response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ spring:
|
||||||
enabledCollect: true # 是否开启监控指标采集,默认false
|
enabledCollect: true # 是否开启监控指标采集,默认false
|
||||||
collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer
|
collectorTypes: logging # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer
|
||||||
monitorInterval: 5
|
monitorInterval: 5
|
||||||
liteflowTp: # 通知报警平台配置
|
liteflowTp:
|
||||||
- threadPoolName: liteflowTp#LiteFlowDefaultWhenExecutorBuilder
|
- threadPoolName: liteflowTp#LiteFlowDefaultWhenExecutorBuilder
|
||||||
corePoolSize: 10
|
corePoolSize: 10
|
||||||
maximumPoolSize: 20
|
maximumPoolSize: 20
|
||||||
|
|
Loading…
Reference in New Issue