Skip to content

Commit

Permalink
optimize liteflow example
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhom1314 committed Sep 11, 2024
1 parent 484be56 commit 515793b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -26,12 +28,14 @@
* @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);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -26,12 +28,14 @@
* @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);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -26,12 +28,14 @@
* @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);
}
}

Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 515793b

Please sign in to comment.