# flowable **Repository Path**: vickyhwj/flowable ## Basic Information - **Project Name**: flowable - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-09 - **Last Updated**: 2022-01-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 参考com.example.demo.MultiPassTest com/example/demo/百分比并指定人通过.bpmn.xml ~~~xml ~~~ 如果想用全票通过或者百分比通过,就把的class换成com.example.demo.listen.AllPassTaskListener或者 com.example.demo.listen.PercPassTaskListener,并且对做出一些调整,其实就是对应类里面的FixedValue multiInstanceLoopCharacteristics里面的isSequential表示是否串行,collection就是集合变量,elementVariable是迭代集合的每个元素变量名 如果flowable:elementVariable="user",flowable:assignee="${user}" 那么就是把迭代的元素user赋值给assignee sequenceFlow里面的流程条件,用el表达式控制 #####flowable避坑指南 ![微信截图_20210617182825](assets/extend/微信截图_20210617182825.png) 1.如果用了serviceTask,如果你中途想挂起任务,那么就要用异步flowable:async="true",为什么? 因为如果你不用异步的话,那么整个流程运转都在一个事务A内,那么你中途用别的线程把流程状态改为挂起,那么 事务A对于流程修改是不可见的(RR隔离级别)。 如果遇到了异步任务执行org.flowable.engine.impl.agenda.ContinueProcessOperation.executeAsynchronous jobService.createAsyncJob(job, flowNode.isExclusive()); jobService.scheduleAsyncJob(job); 异步的原理其实就是有个线程每个一段时间轮询act_ru_job,执行符合条件的job,挂起的原理是把act_ru_job移到act_ru_suspended_job 异步任务如果抛出了异常,会被catch然后执行org.flowable.job.service.impl.asyncexecutor.ExecuteAsyncRunnable#handleFailedJob 然后默认是执行JobRetryCmd,JobRetryCmd的执行过程是先看JobEntity,如果重试次数<=1,就会转移到act_ru_deadletter_job,否则转移到 act_ru_timer_job,并且重试次数-1。 有一个线程是轮询act_ru_timer_job org.flowable.job.service.impl.asyncexecutor.AcquireTimerJobsRunnable#run然后commandExecutor.execute(new MoveTimerJobsToExecutableJobsCmd(jobManager, timerJobs)); 把符合条件的数据从act_ru_timer_job转移到act_ru_job 2.父任务执行完,子任务也会跟着结束