-
1. Re: spawning workflow from action handler Q
aguizar Mar 3, 2006 2:34 PM (in response to fmuhlenberg)Why do you need to spawn a workflow from an action handler? Process states are designed just for that purpose. If you really have to do it, the implementation of org.jbpm.graph.node.ProcessState.execute() will help you.
-
2. Re: spawning workflow from action handler Q
aguizar Mar 3, 2006 3:40 PM (in response to fmuhlenberg)I was in Reston for a public jBPM training last year. Beatiful place :-) A bit cold for my taste, tough.
-
3. Re: spawning workflow from action handler Q
tom.baeyens Mar 5, 2006 2:58 AM (in response to fmuhlenberg)alex,
indeed, the process-state is the main use case for process composition.
but there are 2 other possibilities that make sense and that we didn't implement yet. the process state synchronizes on the end of the process instance. you might want to launch a new process instance without waiting for it to end. one possibility is to do this from a node (e.g. by adding a kind of 'dontwait' attribute to the process-state). or from an action.
regards, tom. -
4. Re: spawning workflow from action handler Q
brianmb99 Mar 5, 2006 3:15 AM (in response to fmuhlenberg)Hi fm,
I have a similar workflow scenario and I use this code in an ActionHandler:JbpmSession sess = JbpmSession.getCurrentJbpmSession(); GraphSession gs = sess.getGraphSession(); ProcessDefinition newprocessDef = gs.findLatestProcessDefinition(newprocessname); if (newprocessDef == null) return; ProcessInstance subprocess = new ProcessInstance(newprocessDef); newprocess.signal();
Is that what you're looking to do? It all runs within the current session this way. I manage the relationship between the new/subprocesses and the parent/superprocesses through mechanisms outside the jBPM super/sub mechanism.
I tried dynamically using subprocesses from a process-state node but couln't get it to work (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76444).
-Brian -
5. Re: spawning workflow from action handler Q
fmuhlenberg Mar 5, 2006 10:06 PM (in response to fmuhlenberg)Brian,
I did realize I could instantiate a process the same way I already had but for some unfathomable reason, I was trying to avoid the call to JbpmSession.getCurrentJbpmSession(). Your suggestion will work for what I want.
Alex,
Reston is nice and will be warming up next weekend and spring is coming.
What I really want to do when I reach my particular node is dynamically append to my existing process instance, then transition along that new path until completion.
Tom, et al,
Would it make any sense to be able to this? Provide a process instance append method that accepts the workflow. The transitions from the new workflow?s start node become the departing transitions from the current node. The read in workflow?s end node would remap to the current process instance?s end node.
Or is this already existing functionality that I am completely overlooking or something that workflow shouldn't be doing?
-fm -
6. Re: spawning workflow from action handler Q
enazareno Mar 6, 2006 12:39 AM (in response to fmuhlenberg)Hi fmuhlenberg,
What I really want to do when I reach my particular node is dynamically append to my existing process instance, then transition along that new path until completion.
Have you tried creating child Tokens from your main process and referencing it to the sub process that you will create? To create a child token, you can useToken t = new Token( mainProcess.getRootToken(), tokenName)
To reference it from the sub process created, set this token in the setSuperProcessToken. You can then signal the parent process from the sub process using getSuperProcessToken().signal. However, if you implement multiple sub processes, I guess you have to implement a fork-join in your parent process.
Regards,
Elmo -
7. Re: spawning workflow from action handler Q
avbentem Mar 29, 2007 4:36 AM (in response to fmuhlenberg)"brianmb99" wrote:
I tried dynamically using subprocesses from a process-state node but couln't get it to work (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76444).
Maybe things were different in the 3.0.2 version of jBPM you were using back then, but in 3.2.Beta2 the following really works just fine (also without the binding attribute):<process-state name="My sub-process"> <sub-process name="my-sub-process" binding="late"/> <transition name="" to="Done"></transition> </process-state>
Arjan.