Spring boot deploy updated definition on runtime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2020 04:09 AM
Hello there! I want to re/deploy a new or updated bpmn model with activiti and spring boot at runtime. When i start the application all processes in resources/processes are loaded and updated. But when i change a model the changes are ignored until the next restart. I start the process with an autowired RuntimeService and startProcessInstanceByKey. I also tried to manually deploy the updated model at runtime like this:
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); repositoryService.createDeployment().name("demoProcess") .addClasspathResource("processes/demo.bpmn20.xml").deploy();
I see the process getting added to the act_ge_bytearray table but when i start a new process the old model gets used and not the new deployed one. How can i tell activiti to activate the new definition? Best case would be that all running processes keep the old version but when i start a new process the latest iteration of that definition gets used. So how can i implement this?
- Labels:
-
Alfresco Process Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 05:05 AM
If you are using Activiti 6 you probably need a tenantId to deploy any resource. I'm not sure that it could solve your problem but I suggest to try the following potential solution.
If you take a look at the unit test included in the APS SDK, based on Activiti 5 Enterprise, you will find a complete example related to a generic Four Eyes workflow:
Below the snippet for deploying a process definition:
repositoryService.createDeployment().addClasspathResource("apps/fourEyes/bpmn-models/4 Eyes Principle-9011.bpmn20.xml") .tenantId(tenantId).deploy().getId(); Map<String, Object> processVars = getProcessInitVariables(String.valueOf(user.getId())); Map<String, Object> taskVars = new HashMap<String, Object>(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKeyAndTenantId("fourEyesPrinciple", processVars, tenantId);
As you can see you may need also the tenantId for creating a new instance of your workflow.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 08:22 AM
Thank you for your fast reply! I am not locked on a specific version of Activiti. I have not heard about tenantId before so thank you for this input. But i am not 100% shure if this is what i need. To me it sounds like you can have multiple process definitions with versioning and on top of that you can have multiple tenants. So if understand this correct i have to track all different tenants in my application and create a new one whenever i want to update an existing process. Is this the only way to handel this? Cant i just deploy a new process definition and then update the version so every process now uses the lates version?
