spring boot activiti整合问题分享

1.pom.xml

     
org.activiti
activiti-spring-boot-starter-basic
5.22.0

2. resources目录下新建processes文件夹放一个xxx.bpmn流程文件

可以自定义默认流程引擎的包,在yml里面设置 例如:

activiti:
    database-schema-update: false
    job-executor-activate: true
    async-executor-activate: true
    process-definition-location-prefix: classpass:/myProcess

3. 定时流程设置

定时流程分定时ServiceTask,和超时UserTask。前者直接在流程节点前面添加一个定时器指定定时时间即可。后者在节点内添加定时器指定到期时间,再从定时器中引线到超时任务处理的task即可,如图:


spring boot activiti整合问题分享_第1张图片
image.png

4. 指定uuid生成策略

@Configuration
public class ActivitiConfig extends AbstractProcessEngineAutoConfiguration {
    //注入数据源和事务管理器
   @Bean
    @ConditionalOnMissingBean
    public SpringProcessEngineConfiguration springProcessEngineConfiguration(
            DataSource dataSource, EntityManagerFactory entityManagerFactory,
            PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException {

        SpringProcessEngineConfiguration config = this.baseSpringProcessEngineConfiguration(dataSource,
                transactionManager, springAsyncExecutor);
        config.setJpaEntityManagerFactory(entityManagerFactory);
        config.setTransactionManager(transactionManager);
        config.setIdGenerator(new StrongUuidGenerator());
        config.setJpaHandleTransaction(false);
        config.setJpaCloseEntityManager(false);
        return config;
    }
}

你可能感兴趣的:(spring boot activiti整合问题分享)