diff --git a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/ACmp.java b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/ACmp.java index 1d72431f..f465b4da 100644 --- a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/ACmp.java +++ b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/ACmp.java @@ -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); } } diff --git a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/BCmp.java b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/BCmp.java index 686080a4..bf4568c6 100644 --- a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/BCmp.java +++ b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/BCmp.java @@ -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); } } diff --git a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/CCmp.java b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/CCmp.java index 56aae552..b2bf80b2 100644 --- a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/CCmp.java +++ b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/cmp/CCmp.java @@ -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); } } diff --git a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/ctx/CusCtx.java b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/ctx/CusCtx.java new file mode 100644 index 00000000..9352a4db --- /dev/null +++ b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/ctx/CusCtx.java @@ -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; +} diff --git a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/service/BizService.java b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/service/BizService.java index 0c5fc427..0f792707 100644 --- a/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/service/BizService.java +++ b/example/example-adapter/example-adapter-liteflow/src/main/java/org/dromara/dynamictp/example/service/BizService.java @@ -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); } } diff --git a/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml b/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml index 1de2a365..f61293d2 100644 --- a/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml +++ b/example/example-adapter/example-adapter-liteflow/src/main/resources/application.yml @@ -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