1

It happened multiple times, that I change the calss name, which is in the bpmn diagram as a serviceTask's delegateExpression value and then the older processes which aren't finished yet, gets an error because it cannot find the class it is in the delegateExpression.

Im just curious about if I can change the delegateExpression's value in runtime in Activiti? For example, I give a method two parameters: oldName and newName, the method changes the delegateExpression's value in all running processes. Then it won't be a problem anymore if I refactor a used class.

I read the Activiti User Guide and in chapter 3.7, there is ACT_RE_... tables in the database and ACT_RE_PROCDEF stores the used bpmn diagram for the process, but I cannot change it because it will need to rebuild the application to make the changes happen. And I think it isn't the proper way to solve this problem.

Soma Básthy
  • 110
  • 1
  • 8
  • 1
    Migrate the old process onto a new one with the new name? Deploy a temporary class with the old name which calls the new one, which you remove when everything completes? – Gagravarr Dec 01 '22 at 10:15
  • But Im wondering if activiti supports any way of doing it programatically. – Soma Básthy Dec 01 '22 at 12:00
  • I don't think it does, you'll have more luck with one of the more actively maintained forks of Activiti like Flowable or Camunda – Gagravarr Dec 01 '22 at 14:02
  • Thanks for the advice I made tmp classes and it works out, but we will change to Camunda soon, so until then it will do the work. – Soma Básthy Dec 06 '22 at 12:58

1 Answers1

3

Your question is primarily about Activiti but i see a flowable tag, so here is how you can change definition values at runtime for older instances programmatically in flowable

Flowable offers a DynamicBpmnServicethat can be used to change part of the process definition without needing to redeploy it.

Here is a sample code snippet that lets you do the same.

dynamicBpmnService.changeServiceTaskDelegateExpression("id","newExpression");

Where id is the definitionId. You can find references here :

https://www.flowable.com/open-source/docs/bpmn/ch04-API/#the-process-engine-api-and-services

https://www.flowable.com/open-source/docs/javadocs/org/flowable/engine/DynamicBpmnService.html

Saideep Ullal
  • 221
  • 3
  • 16