flowable ProcessEngine和ProcessEngineConfiguration
Posted teamlet
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了flowable ProcessEngine和ProcessEngineConfiguration相关的知识,希望对你有一定的参考价值。
ProcessEngine是流程引擎,ProcessEngineConfiguration与前面四个引擎配置有些不同。
ProcessEngineConfiguration增加了邮件服务和httpClient的封装。
一、实例化
ProcessEngineConfiguration 提供了7个公共的静态方法用于实例化。
public static ProcessEngineConfiguration createStandaloneProcessEngineConfiguration()
return new StandaloneProcessEngineConfiguration();
public static ProcessEngineConfiguration createStandaloneInMemProcessEngineConfiguration()
return new StandaloneInMemProcessEngineConfiguration();
二、创建ProcessEngine
创建ProcessEngine的方法是在ProcessEngineConfiguration的子类 ProcessEngineConfigurationImpl中提供的。
@Override
public ProcessEngine buildProcessEngine()
init();
ProcessEngineImpl processEngine = new ProcessEngineImpl(this);
...
return processEngine;
三、初始化服务
创建引擎过程调用init()方法时,初始化服务。
public void init()
...
initServices();
...
public void initServices()
initService(repositoryService);
initService(runtimeService);
initService(historyService);
initService(identityService);
initService(taskService);
initService(formService);
initService(managementService);
initService(dynamicBpmnService);
public void initService(Object service)
if (service instanceof ServiceImpl)
((ServiceImpl) service).setCommandExecutor(commandExecutor);
这些服务定义在 ProcessEngineConfigurationImpl 中:
protected RepositoryService repositoryService = new RepositoryServiceImpl();
protected RuntimeService runtimeService = new RuntimeServiceImpl();
protected HistoryService historyService = new HistoryServiceImpl(this);
protected IdentityService identityService = new IdentityServiceImpl(this);
protected TaskService taskService = new TaskServiceImpl(this);
protected FormService formService = new FormServiceImpl();
protected ManagementService managementService = new ManagementServiceImpl();
protected DynamicBpmnService dynamicBpmnService = new DynamicBpmnServiceImpl(this);
初始化使AbstractEngineConfiguration的 CommandExecutor传递到这些服务的父类 ServiceImpl 中。
这些服务随着 processEngineConfigurationImpl实例传递给 processEngin实例。
以上是关于flowable ProcessEngine和ProcessEngineConfiguration的主要内容,如果未能解决你的问题,请参考以下文章