cancel
Showing results for 
Search instead for 
Did you mean: 

Restart/refresh engine at runtime

tdtappe
Confirmed Champ
Confirmed Champ
Imagine a multi-tenant database (tenant column in each table). For Activiti the process definitions and instances are prefixed with a tenant specific string. Now I want to offer a backup/restore mechanism. Backup is no problem. All relevant data is stored in csv files. Each table results in a csv file.
But what to do after restoring the data from a backup file? Is there a way to tell Activiti to reload/refresh its data from the persistence layer? Or is there some safe way to restart the engine?

–Heiko
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
You can always call processEngine.shutdown() and create a new process-engine from the factory again, if you want activiti to reboot without rebooting the JVM…

Perfect! 🙂
Unfortunately I can't find "shutdown" for a process engine (in 5.13). Did you mean "close"?
And for starting the process engine I use the cdi extension which automatically starts the engine after the application deployment. If I now want to restart the engine I probably have to do similar things. Especially it seems to be necessary to set the newly created process engine via ActivityServices.setProcessEngine!?
So what would be the best way to (re)start the process engine in this scenario?

Maybe like this?
<code>
processEngine.close();
activitiServices.setProcessEngine(processEngineLookup.getProcessEngine());
</code>

danielhale
Champ in-the-making
Champ in-the-making
Thanks frederikheremans!!

visitar

trademak
Star Contributor
Star Contributor
Yes it's the close method that Frederik was referring to.
If you use the CDI extension it's a bit harder to do this. You would have to look into the internals of the activiti-cdi what's done at startup.

Best regards,