Creating Delegate class dynamically

Hi my requirement is I need to create BPMN Model dynamically. I’m able to create the BPMN Model which contains service tasks and exclusive gateways. Is it possible to create delegate classes which we give for each service task for example : ${ruleOneTask} dynamically. Here ruleOneTask class should be created at runtime.

Can anyone help me on this

This question is fairly complex so let’s try to break it down a little. The delegate expression ${ruleOneTask} is evaluated by Flowable’s expression expression manager to resolve a variable named “ruleOneTask” into a delegate instance for the service task. In the Spring boot world, you would normally create a delegate bean named “ruleOneTask”. Since you want to dynamically control the delegate instance, you have a few choices. One possibility is to dynamically create appropriately named Spring beans matching the name in your delegate expression. Another possibility is to override the Flowable expression manager to control how delegate instances are resolved and incorporate your own custom logic. For Spring boot, you could subclass the SpringExpressionManager class to add your own logic and set the expression manager in your configuration. The question of how to dynamically create delegate is really up to you.

Thank you for the reply.

To add to what @jwashington,

When using a delegate expression nothing is stopping you to use ${ruleOneTaskCreator.createDelegate()}. You can pass parameters etc to it. The important part is the method to return back JavaDelegate.

Cheers,
Filip