Create flowable workflow dynamically

Hi, my requirement is

  1. I need to create workflow dynamically. I’m able to create it but based on output of any of the task I need to create or add few more service tasks to the parent workflow dynamically. How can I achieve this. ?

  2. When I get any update regarding the current workflow like any new task added or changed I need to redeploy the whole process again. How can I do this?

Can any one guide me on this?

  1. Depends on what you mean with dynamic: dynamic at creation time or at runtime?
    If the first, you can use the Java API to build the flow programmatically.
    If the latter, you can have a look at the RuntimeService#createChangeActivityStateBuilder method.

  2. You can always redeploy through the RepositoryService#createDeployment. But that’s probably not what you mean?

Thank for your response.

Regarding redeployment : I need to run a job for every 15 min and check whether any update got for any of task in the process which is currently running in the runtime and based on the output I should redeploy the process.

Can anyone help me on this ?