本文主要是介绍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中提供的。
@Overridepublic 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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!