工作流引擎flowable(工作流引擎有哪些)
flowable工作流分支汇聚
????flowable 常用的有三种网关:并行网关,排他网关,包容网关
????并行网关:所有网关后的活动都会同时启动,即使有条件也会忽略条件,汇聚时,所有完成的线路在此等候。直到所有的线路都执行完成,才继续向下执行
????排他网关:按照输出流的顺序计算 ,第一个满足条件的活动会启动,其他的直接忽略,如果所有的条件都不满足,引擎会抛出异常。只有一个分支
????包容网关:判断每一个条件,符合条件的活动启动,不符合不会启动。汇聚时,等待所有启动的线路全部完成,才会继续下一个节点
????注:此处的启动,是指活动产生相应的活动实例
????所有的分支活动都会启动,汇聚节点会启动多次。
? ??
例1:
不存在网关时,启动流程同时开启,A,B两个活动。 A提交产生C, B提交也会产生C。 同时会存在两个C ,提交一个C的时候,流程不会结束,另外一个C还可以继续提交,第二个C提交后,流程结束。
例:2:
流程同时产生A,B 两个活动,A提交了到达网关,等待B提交。B提交了才会到达C
总结:使用网关按照网关的规定执行,不使用网关,之前启动,即使同一个节点可能启动多次。
springboot 整合 flowable 流程引擎
?1. pom
parent
groupIdorg.springframework.boot/groupId
artifactIdspring-boot-starter-parent/artifactId
version2.5.2/version
relativePath / !-- lookup parent from repository --
/parent
properties
project.build.sourceEncodingUTF-8/project.build.sourceEncoding
project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding
java.version1.8/java.version
shiro.version1.5.3/shiro.version
flowable.version6.6.0/flowable.version
maven-jar-plugin.version3.0.0/maven-jar-plugin.version
/properties
========================
!--flowable工作流依赖--
? ? ? ? dependency
? ? ? ? ? ? groupIdorg.flowable/groupId
? ? ? ? ? ? artifactIdflowable-spring-boot-starter/artifactId
? ? ? ? ? ? version${flowable.version}/version
? ? ? ? /dependency
!-- --
dependency
? ? groupIdorg.flowable/groupId
? ? artifactIdflowable-json-converter/artifactId
? ? version${flowable.version}/version
/dependency
!-- app 依赖 包含 rest,logic,conf --
dependency
? ? groupIdorg.flowable/groupId
? ? artifactIdflowable-ui-modeler-rest/artifactId
? ? version${flowable.version}/version
/dependency
dependency
? ? groupIdorg.flowable/groupId
? ? artifactIdflowable-ui-modeler-logic/artifactId
? ? version${flowable.version}/version
? ? exclusions
? ? ? ? exclusion
? ? ? ? ? ? groupIdorg.apache.logging.log4j/groupId
? ? ? ? ? ? artifactIdlog4j-slf4j-impl/artifactId
? ? ? ? /exclusion
? ? /exclusions
/dependency
dependency
? ? groupIdorg.flowable/groupId
? ? artifactIdflowable-ui-modeler-conf/artifactId
? ? version${flowable.version}/version
/dependency
2. 配置类
package org.fh.config;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
/**
* 说明:Flowable配置
* from:fhadmin.cn
*/
@Controller
@Configuration
public class FlowableConfig implements EngineConfigurationConfigurerSpringProcessEngineConfiguration {
? ? @Override
? ? public void configure(SpringProcessEngineConfiguration engineConfiguration) {
? ? ? ? engineConfiguration.setActivityFontName("宋体");
? ? ? ? engineConfiguration.setLabelFontName("宋体");
? ? ? ? engineConfiguration.setAnnotationFontName("宋体");
? ? }
}
3. 配置文件?flowable.properties
blobType=BLOB
boolValue=TRUE
prefix=
flowable变量获取失败
spring boot
flowable中反序列化流程变量失败Couldn‘t deserialize object in variable ‘xxxx‘
forgetmetoo
原创
关注
0点赞·1400人阅读
flowable中反序列化流程变量失败Couldn't deserialize object in variable 'xxxx'
devops自动化项目中使用flowable(类似于activiti的流程引擎)来进行自动化流程编排,需要将每个步骤执行的结果使用流程变量来保存,由于数据类型未知,采用fastjson来保存对象变量,使用flowable的api进行变量存储:
MapString, Object rootNodeMap = new HashMap();
String responseNode = "response";
String requestNode = "request";
// 省略resultMap处理
// 省略resultMap处理
rootNodeMap.put(responseNode, resultMap);
rootNodeMap.put(requestNode, requestMap);
runtimeService.setVariable(processInstanceId, "rootNode", rootNodeMap);
登录后复制
由于流程变量中包含有对象嵌套数组的情况,在使用fastjson的JSONObject保存了主节点以后,在后续使用rootNode变量时,会出现反序列化失败的情况。具体错误堆栈如下:
org.flowable.common.engine.api.FlowableException: Couldn't deserialize object in variable 'rootNode'
at org.flowable.variable.service.impl.types.SerializableType.deserialize(SerializableType.java:117)
at org.flowable.variable.service.impl.types.SerializableType.getValue(SerializableType.java:65)
at org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntityImpl.getValue(VariableInstanceEntityImpl.java:132)
at org.flowable.variable.service.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:271)
at org.flowable.variable.service.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:250)
at org.flowable.common.engine.impl.el.VariableContainerELResolver.getValue(VariableContainerELResolver.java:39)
at org.flowable.engine.impl.el.ProcessVariableScopeELResolver.getValue(ProcessVariableScopeELResolver.java:57)
at org.flowable.common.engine.impl.javax.el.CompositeELResolver.getValue(CompositeELResolver.java:234)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstIdentifier.eval(AstIdentifier.java:95)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstProperty.eval(AstProperty.java:68)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstProperty.eval(AstProperty.java:68)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstBinary$SimpleOperator.eval(AstBinary.java:31)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstBinary.eval(AstBinary.java:112)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:53)
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:31)
at org.flowable.common.engine.impl.de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)
at org.flowable.engine.impl.delegate.invocation.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:34)
at org.flowable.engine.impl.delegate.invocation.DelegateInvocation.proceed(DelegateInvocation.java:35)
at org.flowable.engine.impl.delegate.invocation.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:26)
at org.flowable.engine.impl.el.JuelExpression.resolveGetValueExpression(JuelExpression.java:44)
at org.flowable.common.engine.impl.el.JuelExpression.getValue(JuelExpression.java:48)
at org.flowable.engine.impl.el.UelExpressionCondition.evaluate(UelExpressionCondition.java:37)
at org.flowable.engine.impl.util.condition.ConditionUtil.hasTrueCondition(ConditionUtil.java:47)
at org.flowable.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:84)
at org.flowable.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:39)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:275)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:159)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:114)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughSequenceFlow(ContinueProcessOperation.java:327)
at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:80)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:88)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
at org.flowable.common.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:56)
at org.flowable.common.spring.SpringTransactionInterceptor$$Lambda$532/1508152985.doInTransaction(Unknown Source)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:56)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:208)
at com.dashuf.srgp.workflow.devops.DevopsTaskAutoCompletedHandler.autoComplete(DevopsTaskAutoCompletedHandler.java:41)
at com.dashuf.srgp.workflow.devops.DevopsTaskAutoCompletedHandler$$FastClassBySpringCGLIB$$f48068ba.invoke(generated)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor$$Lambda$663/1969812924.call(Unknown Source)
at com.dashuf.srgp.config.CustomThreadPoolTaskExecutor.lambda$submit$8(CustomThreadPoolTaskExecutor.java:46)
at com.dashuf.srgp.config.CustomThreadPoolTaskExecutor$$Lambda$664/488650178.call(Unknown Source)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.alibaba.fastjson.JSONException: autoType is not support. [B
at com.alibaba.fastjson.parser.ParserConfig.checkAutoType(ParserConfig.java:920)
at com.alibaba.fastjson.parser.ParserConfig.checkAutoType(ParserConfig.java:911)
at com.alibaba.fastjson.JSONObject$SecureObjectInputStream.resolveClass(JSONObject.java:548)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1664)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345)
at java.io.ObjectInputStream.access$300(ObjectInputStream.java:206)
at java.io.ObjectInputStream$GetFieldImpl.readFields(ObjectInputStream.java:2157)
at java.io.ObjectInputStream.readFields(ObjectInputStream.java:541)
at java.math.BigInteger.readObject(BigInteger.java:4258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:501)
at java.math.BigDecimal.readObject(BigDecimal.java:3748)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:501)
at com.alibaba.fastjson.JSONObject.readObject(JSONObject.java:488)
at sun.reflect.GeneratedMethodAccessor1138.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
at sun.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at org.flowable.variable.service.impl.types.SerializableType.deserialize(SerializableType.java:113)
... 57 common frames omitted
登录后复制
看字面意思理解,应该是无法识别关键字[B,猜测应该是fastjson在序列化的时候写入class的数据类型,看起来像是Byte数组之类,目前使用的fastjson版本是1.2.49版本,在github搜索了一下,目前最新版本已经到1.2.76,并且中间有一些issue提到Array、Map等,和我的应用场景比较相似,这些issue已经进行了升级解决。
于是尝试着将fastjson版本升级到1.2.76,再次执行,成功通过,问题解决。
这个问题排查定位从上周五的晚上一直到本周一的早上,持续时间很长,但是修改方式却非常简单,只是升级了fastjson的版本而已,之前一直没有怀疑是fastjson的问题,而是将重点放在自己的中间数据处理上面。所以后续遇到类似问题,可以先尝试这种快捷的方案,节约时间。
devops
activiti
java
spring boot
个人写真照片
精选推荐
广告
Couldn't deserialize object in variable 'user1' 反序列化失败
4620阅读·0评论·0点赞
2017年2月17日
org.activiti.engine.ActivitiException: coudn‘t deserialize object in variable ‘a‘.获取流程变量无法反序列化问题。
1025阅读·0评论·2点赞
2019年10月20日
解决:Caused by: org.flowable.common.engine.api.FlowableWrongDbException: version,问题
5893阅读·0评论·1点赞
2021年5月21日
org.activiti.engine.ActivitiException: Couldn't deserialize object in variable 'application'
619阅读·0评论·0点赞
2016年12月23日
Cannot construct instance of `com.*` (although at least one Creator exists): cannot deserializ
3.0W阅读·7评论·6点赞
2020年3月3日
个人委托律师授权委托书,专业经验丰富
精选推荐
广告
[Flowable6.4.1]DMN报错Error parsing '#{input1 == 19 }': syntax error at position 13, encountered ''...
2336阅读·0评论·0点赞
2019年4月15日
Flowable 一些异常报错、注意事项(4)
1532阅读·0评论·1点赞
2022年4月21日
Flowable实战(一)启动第一个完整流程
2661阅读·5评论·13点赞
2022年1月7日
Activity FlowableException: Couldn't serialize value
874阅读·0评论·0点赞
2019年12月29日
Flowable工作流兼容达梦数据库
1332阅读·0评论·0点赞
2021年10月8日
使用Mycat时,activiti出现异常 Couldn‘t deserialize object in variable ‘assignee‘
610阅读·0评论·0点赞
2020年9月23日
使用Mycat时,activiti出现异常 Couldn't deserialize object in variable 'assignee'
4448阅读·2评论·0点赞
2018年8月17日
flowable 流程表单_Flowable 实现【选择下一步流程审核人】
1258阅读·0评论·0点赞
2020年12月19日
java 类不能序列化_Java : 实体类不能序列化异常
363阅读·0评论·0点赞
2021年2月13日
activiti在运行时报错:couldn‘t find a variable type that is able to serialize XXX
1224阅读·0评论·0点赞
2021年3月30日
Flowable FlowableException:flowable-exclusive-gateway-condition-not-allowed-on-single-seq-flow
570阅读·1评论·1点赞
2022年3月21日
Activiti基础 condition expression returns non-Boolean 解决方案
1.3W阅读·7评论·5点赞
2018年8月19日
nested exception is org.flowable.common.engine.api.FlowableException: Error initialising dmn data mo
工作流引擎flowable基于springboot下,命令模式实现源码分析
在init()方法里,有一大堆的初始化。有个方法initCommandExecutors();
方法initCommandExecutors里的内容如下
方法initCommandInterceptors里的getDefaultCommandInterceptors内容
创建了各种拦截器,也就是当执行某个命令时,会执行这些拦截器。(包括了日志、事务等拦截器)
例如当执行taskService.complete完成任务时,会被事务拦截器拦截,启动事务等其它功能,如果需要我们也可以自定义拦截器
方法initCommandExecutor里的内容如下
把各个拦截器命令串联起来