嵌入式部署
在Servelet的listener里构建ProcessEngine
单独部署
Rest接口
两种模式应用场景:
多个应用同时需要使用流程系统,用单独部署;
需要定制化的流程系统,用嵌入式。
监听器来初始化流程引擎
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/activiti-context.xml</param-value>
</context-param>
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Spring监听器初始化Activiti
Rest Service
Spring初始化Activiti
在Listener里面初始化Activiti
Spring中,Activiti的配置
public class ErrorServiceTask implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
if(execution.hasVariable("throwError") &&
Boolean.valueOf(execution.getVariable("throwError").toString()
throw new IllegalArgumentException("Rollback!!");
}
}
}
结合Transactional和Activiti
<property name="jobExecutorActivate" value="false" />
任务相关的配置
<property name="history" value="audit" />
历史数据相关配置
![](https://i-blog.csdnimg.cn/blog_migrate/dcb98d8de0227b8b1ec85506c3e32d5c.png)
![](https://i-blog.csdnimg.cn/blog_migrate/864df36d51b10b00ac01c9133fde9a51.png)
Rest Service
![](https://i-blog.csdnimg.cn/blog_migrate/044c28f041ddcac83d19e09790675d65.png)
Rest Service