当前位置: 首页 > news >正文

贵阳能做网站的公司杭州网站改版公司

贵阳能做网站的公司,杭州网站改版公司,godaddy主机到网站,模板网站系统文章目录 官网地址简要项目引入maven 所需jar包配置 PostgreSQL 数据库表使用LiteFlow配置 yml 文件通过 代码方式使用 liteflow数据库sql 数据在流程中周转 官网地址 https://liteflow.cc/ 简要 如果你要对复杂业务逻辑进行新写或者重构#xff0c;用LiteFlow最合适不过。… 文章目录 官网地址简要项目引入maven 所需jar包配置 PostgreSQL 数据库表使用LiteFlow配置 yml 文件通过 代码方式使用 liteflow数据库sql 数据在流程中周转 官网地址 https://liteflow.cc/ 简要 如果你要对复杂业务逻辑进行新写或者重构用LiteFlow最合适不过。它是一个编排式的规则引擎框架组件编排帮助解耦业务代码让每一个业务片段都是一个组件。 利用LiteFlow你可以将瀑布流式的代码转变成以组件为核心概念的代码结构这种结构的好处是可以任意编排组件与组件之间是解耦的组件可以用脚本来定义组件之间的流转全靠规则来驱动。LiteFlow拥有开源规则引擎最为简单的DSL语法。十分钟就可上手。 LiteFlow的脚本组件支持众多脚本语言完全和Java打通你可以用脚本来实现任何逻辑。 项目引入 maven 所需jar包 liteflow-spring-boot-starter: 这是 LiteFlow 的核心依赖它集成了 LiteFlow 与 Spring Boot 框架使得你可以轻松地在 Spring Boot 项目中使用 LiteFlow 来进行流程管理。 liteflow-rule-sql: 此模块提供了从 SQL 数据库加载规则的能力使你可以将流程定义存储在数据库中并根据需要动态加载它们。 liteflow-script-groovy: 该依赖项允许你在 LiteFlow 中使用 Groovy 脚本语言来编写脚本节点。Groovy 是一种强大的动态语言非常适合编写简短而灵活的脚本逻辑。 liteflow-script-javax: 提供了使用 Java 编写的脚本节点支持允许更深入地集成业务逻辑。 liteflow-script-aviator: Aviator 是一个轻量级的表达式语言引擎这个依赖允许你在 LiteFlow 中使用 Aviator 表达式来简化条件判断和其他逻辑操作。 propertiesliteflow.version2.12.4.1/liteflow.version /properties dependenciesdependencygroupIdio.springfox/groupIdartifactIdspringfox-boot-starter/artifactId/dependencydependencygroupIdcom.yomahub/groupIdartifactIdliteflow-spring-boot-starter/artifactIdversion${liteflow.version}/version/dependencydependencygroupIdcom.yomahub/groupIdartifactIdliteflow-rule-sql/artifactIdversion${liteflow.version}/version/dependencydependencygroupIdcom.yomahub/groupIdartifactIdliteflow-script-groovy/artifactIdversion${liteflow.version}/version/dependencydependencygroupIdcom.yomahub/groupIdartifactIdliteflow-script-javax/artifactIdversion${liteflow.version}/version/dependencydependencygroupIdcom.yomahub/groupIdartifactIdliteflow-script-aviator/artifactIdversion${liteflow.version}/version/dependency /dependencies配置 PostgreSQL 数据库表使用LiteFlow 配置 yml 文件 rule-source-ext-data-map 这部分定义了 LiteFlow 如何从外部数据源加载规则信息。具体来说applicationName: 应用名称这里是 dataprocessing它用于标识当前应用。chainTableName: 规则链表名即 sys_rule_chainLiteFlow 将从此表中读取规则链信息。字段映射:chainApplicationNameField: 表示规则链所属的应用名称字段这里为 application_name。chainNameField : 规则链名称字段对应 chain_name。elDataField : 表达式数据字段即 el_data通常用于存储条件表达式或执行逻辑。routeField : 路由字段表示 route。namespaceField : 命名空间字段对应 namespace。chainEnableField : 启用状态字段表示 enable用于控制是否启用该规则链。 Script 表配置可选 如果你的应用使用脚本来增强规则链的功能可以配置这些选项scriptTableName : 脚本表名这里是 sys_rule_script。scriptIdField, scriptNameField, scriptDataField, scriptTypeField, scriptLanguageField, scriptEnableField : 分别指定了脚本 ID、名称、数据内容、类型、语言和启用状态的字段名。 轮询机制 pollingEnabled : 设置为 true 表示启用了轮询机制LiteFlow 将定期检查是否有新的或更新的规则需要加载。pollingStartSeconds : 定义首次轮询开始的时间点设置为 0 意味着服务启动后立即开始第一次轮询。pollingIntervalSeconds: 定义两次轮询之间的间隔时间这里是每5秒一次。 解析模式 (parse-mode) parse_one_on_first_exec: 这个模式意味着当一个链首次被执行时LiteFlow 会解析该链并在后续执行中使用缓存的结果。只有当检测到有变更时如通过轮询发现才会重新解析。 liteflow:rule-source-ext-data-map:applicationName: demo#以下是chain表的配置这个一定得有chainTableName: chainchainApplicationNameField: application_namechainNameField: chain_nameelDataField: el_datarouteField: routenamespaceField: namespacechainEnableField: enable#以下是script表的配置如果你没使用到脚本下面可以不配置scriptTableName: scriptscriptApplicationNameField: application_namescriptIdField: script_idscriptNameField: script_namescriptDataField: script_datascriptTypeField: script_typescriptLanguageField: languagescriptEnableField: enable#以下是轮询机制的配置pollingEnabled: truepollingStartSeconds: 0pollingIntervalSeconds: 5parse-mode: parse_one_on_first_exec通过 代码方式使用 liteflow LiteflowComponent 是 LiteFlow 框架中的一个注解用于标识一个类为 LiteFlow 组件。这个注解类似于 Spring 框架中的 Component 注解但它具有特定于 LiteFlow 的功能和用途。 a,b,c, d 代码实例 LiteflowComponent(a) public class ACmp extends NodeComponent {Overridepublic void process() {System.out.println(ACmp executed!);} }LiteflowComponent(b) public class BCmp extends NodeComponent {Overridepublic void process() {System.out.println(BCmp executed!);}} LiteflowComponent(c) public class CCmp extends NodeComponent {Overridepublic void process() {System.out.println(CCmp executed!);}}LiteflowComponent(d) public class DCmp extends NodeComponent {Overridepublic void process() {System.out.println(DCmp executed!);}}数据库sql create table chain (id bigint auto_incrementprimary key,application_name varchar(32) null,chain_name varchar(32) null,chain_desc varchar(64) null,el_data text null,route text null,namespace varchar(32),create_time datetime null,enable tinyint(1) 1 );create table script (id bigint auto_incrementprimary key,application_name varchar(32) null,script_id varchar(32) null,script_name varchar(64) null,script_data text null,script_type varchar(16) null,language varchar(32) null,enable tinyint(1) 1 );INSERT INTO chain (id, application_name, chain_name, chain_desc, el_data, route, namespace, create_time, enable) VALUES (1, demo, chain1, 测试流程, THEN(a,b,c,s1,s2,s3,s4);, null, null, 2022-09-19 19:31:00, 1); INSERT INTO chain (id, application_name, chain_name, chain_desc, el_data, route, namespace, create_time, enable) VALUES (3, demo, r_chain1, 策略路由1, THEN(b,a,s1);, r1, ns, 2024-05-27 14:03:01, 1); INSERT INTO chain (id, application_name, chain_name, chain_desc, el_data, route, namespace, create_time, enable) VALUES (4, demo, r_chain2, 策略路由2, THEN(a,b,s2);, OR(r1,r2), ns, 2024-05-27 14:03:44, 1);INSERT INTO script (id, application_name, script_id, script_name, script_data, script_type, language, enable) VALUES (1, demo, s1, 脚本s1, import cn.hutool.core.date.DateUtildef date DateUtil.parse(2022-10-17 13:31:43) println(date) defaultContext.setData(demoDate, date)class Student {int studentIDString studentName }Student student new Student() student.studentID 100301 student.studentName 张三 defaultContext.setData(student,student)def a3 def b2 defaultContext.setData(s1,a*b), script, groovy, 1); INSERT INTO script (id, application_name, script_id, script_name, script_data, script_type, language, enable) VALUES (2, demo, s2, 脚本s2, defaultContext.setData(s2,hello), script, groovy, 1); INSERT INTO script (id, application_name, script_id, script_name, script_data, script_type, language, enable) VALUES (3, demo, s3, 脚本s3, setData(defaultContext, s3, 5*6);, script, aviator, 1); INSERT INTO script (id, application_name, script_id, script_name, script_data, script_type, language, enable) VALUES (4, demo, s4, 脚本4, import cn.hutool.core.collection.ListUtil;import com.yomahub.liteflow.script.body.CommonScriptBody;import com.yomahub.liteflow.slot.DefaultContext;import com.yomahub.liteflow.spi.holder.ContextAwareHolder;import com.example.liteflow.mysql.vo.Person;import com.yomahub.liteflow.script.ScriptExecuteWrap;import java.util.List;import java.util.function.ToIntFunction;public class Demo implements CommonScriptBody {public Void body(ScriptExecuteWrap wrap) {DefaultContext ctx wrap.getCmp().getFirstContextBean();ListPerson personList ListUtil.toList(new Person(jack, 15000),new Person(tom, 23500),new Person(peter, 18500));int totalSalary personList.stream().mapToInt(Person::getSalary).sum();System.out.println(totalSalary);ctx.setData(salary, totalSalary);return null;}}, script, java, 1); 数据在流程中周转 liteflow 是进行流程上下文的方式去 读取存储数据 我们在组件里面写业务首先肯定就是要拿到上下文在声明式组件里通常的写法为 LiteflowMethod(value LiteFlowMethodEnum.PROCESS,nodeType NodeTypeEnum.COMMON, nodeId b) public void processB(NodeComponent bindCmp) {YourContext context bindCmp.getContextBean(YourContext.class);//从context中取到业务数据进行处理User user context.getUser();... }具体参考官网 https://liteflow.cc/pages/8777f8/
http://www.hkea.cn/news/14390887/

相关文章:

  • 找做网站找那个平台做高流量网站开发框架经验
  • 淮南网站建设费用商业空间设计ppt
  • 哪里有男男做受网站唐山网站建设方案报价
  • 怎么做考试资料网站html5个人网站源码
  • 网站 建设公司打电话推销好还是做网站推广好
  • 国外网站引流如何做网站建设方维
  • 一般做淘宝的素材都有哪个网站dedecms5.7 财经网站
  • 定制网站制作公司有哪些企业年金退休能拿多少
  • 南阳做网站哪家好seo中文意思
  • 合肥有什么好的网站建设公司网页制作与维护
  • 网站后台的网址忘记了怎么做企业功能网站
  • 网站建设开发多少钱网站建设顶层设计
  • jsp可以做那些小网站怎样获得做网站的客户
  • 网站加入购物车的代码云主机如何做两个网站
  • 做百度推广需要有网站吗工业园做网站的公司
  • seo站外推广海外电商平台有哪些
  • 南宁做企业网站运营企业网站
  • 网页界面设计内容分站城市网站如何做seo
  • 网站建设分金手指排名八广德做网站设计开发
  • 赵县住房和城乡建设局网站首页竞价sem培训
  • 百度快照 查看指定网站wordpress 不同站点
  • 长春网站建设公司怎么样抖音 运营
  • 做网站内容管理器要吗针织外贸公司
  • 带屏蔽的网站做水晶头seo关键词是什么意思
  • win7 发布asp网站哪个公司的app软件定制
  • 做企业网站的哪家好wordpress 不显示菜单
  • 网站设计建网站2023今天的新闻联播
  • 便民类网站 做wordpress 手册插件
  • 用群晖nas做网站南山做网站
  • 广州高档网站建设网站设计框架