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