4 Replies Latest reply: Apr 27, 2006 1:23 AM by Ronald van Kuijk RSS

Dynamically adding Task Nodes at runtime?

Aaron Novice

Hey all! I've been scrounging through the forums and docs, but haven't really found anything. I'm rumaging around in the javadocs now.

I have a process (or will have a process), that assigns users to a project (workflow) at runtime. So, I'll need to have a way to load up the process definition, and programmatically, add a fork with as many Task Nodes per user that was assigned.

that way, the project is not completed, until ALL tasks are done (JOIN), but the users aren't defined until runtime. I haven't found a way to do this yet.

Anyone doing this? I'm still scrounging around in the javadoc and the online documentation to get a good "feel" for jBPM.

Thanks all!
~~Aaron

  • 1. Re: Dynamically adding Task Nodes at runtime?
    Ronald van Kuijk Master

    Have you looked at www.workflowpatterns.com? Is pattern 16 (Multiple instances without a prori runtime knowledge) the pattern you need? If so, look at the testcases of jbpm. There is an example, Wfp16MiWithoutAPrioriRuntimeKnowledge.java, which demonstrates this.

    Ronald

  • 2. Re: Dynamically adding Task Nodes at runtime?
    Aaron Novice

    Yup! That's exactly what I am referrng to. You are on the ball!

    Thank you Ronald. I will look at the testcase.

    ~~Aaron

  • 3. Re: Dynamically adding Task Nodes at runtime?
    Aaron Novice

    Ronald, you definately pointed me in the right direction, but now I'm confused when I'm looking at the test cases.

    In all reality, my scenario is actually Patern14 (Multiple Instances with a priori runtime knowledge).

    In other words, I will be using a FOR loop to loop through and create the tasks, rather than a while loop. Which means, that the tasks varies from the process definition, but I will know how many tasks to create prior to the transition 't' (before leaving state 'b').

    However, I'm looking at the testCase for pattern14, but the testcase is not testing pattern14. It's just testing a standard process definition. Pattern 14 states the number of tasks varies, correct? (i.e. creating tasks based on a FOR loop). But, the testcase only tests the tasks defined in the process definition.

    Hmmmm

  • 4. Re: Dynamically adding Task Nodes at runtime?
    Ronald van Kuijk Master

    pattern 14 states the number of tasks is nowm design time. Therefor a fixed number of tasks is in the node. It is not a 'default' process since there is more than one task in the tasknode.

    pattern 15 uses a for loop which gets it's 'number' from e.g a process variable.

    In the testcases only one actor is there. If you want them assigned to different users, you have to extend the code a little.