[jboss-user] [JBoss jBPM] - Implementing concurrent dynamic tasks in jbpm4
mwohlf
do-not-reply at jboss.com
Wed Aug 19 09:14:18 EDT 2009
I try to implement "Pattern 15" in jbpm4
http://www.workflowpatterns.com/patterns/control/multiple_instance/wcp15.php
"Multiple Instances without a priori Run-Time Knowledge"
try 1)
I use a custom implementation of ExternalActivityBehaviour, that basically just waits for signals to spawn off dynamic task instances, the code in signal() to do this looks like this:
| DbSession dbSession = Environment.getFromCurrent(DbSession.class);
|
| // create new task
| TaskImpl task = (TaskImpl) dbSession.createTask();
| task.setName(taskname);
| task.setNew(true); // no idea what this is but looks good
| task.setExecution(execution);
| task.setProcessInstance(execution.getProcessInstance());
| task.setSignalling(false);
| task.setAssignee("assignor");
| task.setActivityName("complete");
|
| // save task
| dbSession.save(task);
|
| // deal with the history table
| HistoryEvent.fire(new TaskCreated(task), execution);
|
this gives me the tasks in the users tasklist and they can be completed, however the problem is the history table, as pointed out in
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=160034
there is no way to get the information about the task instance from the taskHistory table, the only useful information would be the activity, but since all these dynamic tasks are created for the same activity this doesn't help much either.
try 2)
My second approach to implement "Pattern 15" is to use dynamic activities like described in:
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=159765
(this isn't exactly the pattern but close enough) the code in this thread implements an event listener which means it can only be invoked on a limited set of workflow events (start, end) when taking
transition or entering nodes as far as I understand (someone please correct me if I am missing something here).
try 3)
So again I tried to implement this in a custom ActivityBehaviour, which can
receive random signals with executionService.signalExecutionById(..). I basically use the code from the event listener which dynamically creates a
new execution first, then a new Activity and wires them with transitions. The code is in the placeViceMentorTask() method at
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=159765
The problem with this approach is:
what is the state of the new execution? Execution.STATE_ACTIVE_CONCURRENT doesn't work since it requires a Execution.STATE_INACTIVE_CONCURRENT_ROOT for the parent execution which means I can no longer signal it for more executions.
the dynamic created activity and its transitions are not in the process definiton and I can't find any database table for the transitions, now when I reboot the process engine they probably will be lost...
so I am running out of ideas and wanted to know if someone is tackling the same problem with more success than I had so far, any ideas are very welcome, the first one with a solution gets a beer from me when he/she is in Stuttgart, Germany
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250391#4250391
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250391
More information about the jboss-user
mailing list