AnsweredAssumed Answered

Not able to create a ProcessEngine Bean to connect a different Data Source

Question asked by gowtham1206 on Nov 13, 2017
Latest reply on Nov 13, 2017 by cjose



I'm using Activiti community version. I've two databases with Activiti Data. One is the old database and another one is the new and primary database to which the ProcessEngine connects (The reason why we are not using ONE single database is we do not want to migrate the HISTORIC data from OLD database to new database). I'm looking to create a wrapper API service to pull the historic process and task instances from both the primary and old database.


This leads to the need of building a new process engine that connects the old database. I'm able to achieve this by building the process engine on runtime using ProcessEngineConfiguration by setting the old data source.


ProcessEngine processEngine = ProcessEngineConfiguration.


Doing this way affects the performance as the wrapper service builds the engine on runtime. However, I'm not able to create a new bean to initialize the ProcessEngine with the old datasource


public ProcessEngine processEngine1x() {
return ProcessEngineConfiguration.


Defining the process engine bean as above throws the below error.








Parameter 0 of method processEngineEndpoint in org.activiti.spring.boot.EndpointAutoConfiguration required a single bean, but 2 were found:

                - processEngine: defined by method 'processEngine' in class path resource [org/activiti/spring/boot/DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration.class]

                - processEngine1x: defined by method 'processEngine1x' in class path resource [com/bnym/nwf/config/NWFConfig.class]




Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed


Is there any other feasible and optimized way of building a separate Process Engine to handle this scenario?


Thanks for the help.