Solon v3.0.6

Hello World

</> markdown

基础知识(字典,接口),可参考:《solon / solon-flow 插件》

1、新建项目

新建项目之后,添加依赖

<dependency>
    <groupId>org.noear</groupId>
    <artifactId>solon-flow</artifactId>
</dependency>

2、添加配置

  • 添加应用配置
solon.flow:
  - "classpath:flow/*"
  • 添加流处理配置(支持 json 或 yml 格式),例: flow/demo1.chain.json
{
  "id": "c1", 
  "nodes": [
    { "id": "n1", "type": "start", "link": "n2"},
    { "id": "n2", "type": "execute", "link": "n3", "task":"System.out.println(\"hello world!\");"},
    { "id": "n3", "type": "end"}
  ]
}

示意图:

3、代码应用

@Component
public class DemoCom implements LifecycleBean{
    @Inject 
    private FlowEngine flowEngine;
    
    @Override
    public void start() throws Throwable {
        flowEngine.eval("c1");
    }
}