solon-flow-eval-aviator
<dependency>
    <groupId>org.noear</groupId>
    <artifactId>solon-flow-eval-aviator</artifactId>
</dependency>
1、描述
(v3.1.2 后支持)流处理扩展插件。在 Solon Flow 基础上提供 aviator (LGPL 许可协议)表达式与脚本适配:
- AviatorEvaluation
2、应用示例
简单配置样例
# classpath:flow/f1.yml
id: f1
layout:
  - task: |
      context.put("result", a + b);
    when: a > b
注解模式应用
@Configuration
public class MagicEvaluationTest {
    //构建新的驱动器,替代旧的(可以反复替代)
    @Bean
    public FlowDriver flowDriver(){
        return new SimpleFlowDriver(new AviatorEvaluation());
    }
    
    @Init
    public void case1() throws Throwable {
        FlowContext context = FlowContext.of();
        context.put("a", 1);
        context.put("b", 2);
        engine.eval("f1", context);
        System.out.println(context.get("result"));
        assert context.get("result") == null;
    }
}
原生 Java 模式应用
public class AviatorEvaluationTest {
    @Test
    public void case1() throws Throwable {
        FlowEngine engine = FlowEngine.newInstance();
        engine.register(new SimpleFlowDriver(new AviatorEvaluation()));
        engine.load("classpath:flow/*.yml");
        FlowContext context = FlowContext.of();
        context.put("a", 1);
        context.put("b", 2);
        engine.eval("f1", context);
        System.out.println(context.get("result"));
        assert context.get("result") == null;
    }
}
 Solon
 Solon