Hi all
I use the Java Bootstrapping API to bootstrap a new process engine. What I want to achieve is that the process engine can be created / deleted at runtime, without the need to restart the Tomcat application server. This bootstrapping of a new process engine works so far. The following code snippet demonstrates this.
List<ProcessEnginePlugin> plugins = new ArrayList<ProcessEnginePlugin>();
plugins.add(new SpinProcessEnginePlugin());
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration()
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setJdbcDriver("com.mysql.jdbc.Driver")
.setJdbcUrl("jdbc:mysql://localhost:3306/camunda_" + tenant.getCamundaIdentifier())
.setJdbcUsername(DATABASE_USER)
.setJdbcPassword(DATABASE_PASSWORD)
.setJobExecutorActivate(true)
.setProcessEngineName(tenant.getCamundaIdentifier())
.setHistory(ProcessEngineConfiguration.HISTORY_FULL);
processEngineConfiguration.setDefaultSerializationFormat("application/json");
processEngineConfiguration.setProcessEnginePlugins(plugins);
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
// Register new process engine
RuntimeContainerDelegate.INSTANCE.get().registerProcessEngine(processEngine);
I wonder how to correctly delete / unregister a process engine.
The following snippet does not seem to completly remove the process engine.
I use a multi tenancy environment with a process engine per tenant.
After executing the following code, the tenant is still visible in the tenant dropdown box in the upper right corner.
ProcessEngine processEngine = RuntimeContainerDelegate.INSTANCE.get().getProcessEngineService().getProcessEngine(tenant.getCamundaIdentifier());
if (processEngine != null) {
// Stop the job executor
ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration();
if (configuration != null && configuration instanceof ProcessEngineConfigurationImpl)
{
((ProcessEngineConfigurationImpl)configuration).getJobExecutor().shutdown();
}
RuntimeContainerDelegate.INSTANCE.get().unregisterProcessEngine(processEngine);
}
What is missing in the code above to delete / unregister a process engine?
Thank you.
Kind regards
Micha Boller