apurv agnihotri [
http://community.jboss.org/people/apurv888] created the discussion
"Subprocess wait state signal handling not working from parent process (jBPM
4.3)"
To view the discussion, visit:
http://community.jboss.org/message/544880#544880
--------------------------------------------------------------
Following is our main jPDL xml
<?xml version=+"1.0" encoding=+"UTF-8"?> ++<process
name=+"PresenceWorkflow"
xmlns=+"http://jbpm.org/4.3/jpdl">
<start g=+"-9,225,80,40">
<transition to=+"wait for presence of user" />
</start>
<sub-process name=+"wait for presence of user"
sub-process-key=+"waitForPresence" g=+"603,195,177,70">
<parameter-in subvar=+"userDetailsInstance"
var=+"user"/><parameter-in subvar=+"timeoutPeriod"
var=+"timeoutPeriodMain"/>
<parameter-out subvar=+"userDetailsInstance"
var=+"user"/><parameter-out subvar=+"subinstanceid"
var=+"subinstanceidMain"/>
<transition name=+"timeout" to=+"state1"
g=+"-47,-20"/>
<transition name=+"success" to=+"state1"
g=+"369,51:-28,-24"/>
</sub-process>
<end g=+"220,486,48,48" name=+"end1"/>
<end-error g=+"140,488,80,40" name=+"internal error"/>
<state g=+"649,418,92,52" name=+"state1"
state=+"naas-wait">
</state> </process>
+++
++
xml version=+"1.0"+ encoding=+"UTF-8"+?>
<
process name=+"waitForPresence"+
xmlns=+http://jbpm.org/4.3/jpdl+>
<
start g=+"8,103,80,40"+>
<transition to=+"wait for presence"+/></
start>
<
custom class=+"com.task.WaitForPresenceTask"+ g=+"121,105,100,52"+
name=+"wait for presence"+>
<transition to=+"task completion check for wait presnce"/+></
custom>
<
decision expr=+"#{TaskCompletionStatus}"+ name=+"task completion check for
wait presence"+ g=+"287,117,110,92"+>
<transition name=+"Success"+ to=+"wait for presence update"+
g=+"-46,-20"+/>
<transition name=+"Failure"+ to=+"failure"+
g=+"-40,-20"+/></
decision>
<
state name=+"wait for presence update"+ g=+"482,114,210,40"+>
<on event=+"timeout"+>
<timer duedate=+"5 seconds"+/>
<event-listener class=+"com.task.WaitStateTimeoutListener"+>
</on>
<on event=+"start"+>
<event-listener
class=+"com.eventlistener.WaitForPresenceStartEventListener"+>
<field name=+"subscriberVariableName"+><object
expr=+"#{userDetailsInstance}"+/></field>
</event-listener>
</on>
<on event=+"end"+>
<event-listener
class=+"com.eventlistener.WaitForPresenceCompletionEndEventListener"+>
<field name=+"subscriberVariableName"+><object
expr=+"#{userDetailsInstance}"+/></field>
</event-listener>
</on>
<transition name=+"WAIT_STATE_TIMED_OUT"+ to=+"timeout"+
g=+"-142,-20"+/>
<transition name=+"AVAILABLE"+ to=+"test"+
g=+"-64,-9"+/>
</
state>
<
end name=+"success"+ g=+"666,410,80,40"+/>
<end name=+"failure"+ g=+"277,415,80,40"+/><
end name=+"timeout"+ g=+"445,414,48,84"+/>
</
process>
Sample test case extract:
// start the main process
final ProcessInstance processInstance =
executionService.startProcessInstanceByKey("PresenceWorkflow",
variables,processInstanceKey);
// send signal to subprocess to get out of "wait for presence update" state.
executionService.signalExecutionById(processInstance.getId(),"AVAILABLE");
++
++
+++++++Problem faced:+++++++
++
+++++++1) Once execution resumes after sending the above signal workflow exists the
subprocess without executing any subsequent tasks. For example, the end event listener is
not invoked.+++++++
++
+++++++2) Unable to get the subprocess execution id. Even if we get the execution id via a
hack, we get an exception sending the signal.+++++++
++++++
+++++++Any help would be very much appreciated.+++
++
++
++Following is the subprocess jPDL
+++
+++
++
++
++
++
+++
+
+
++
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/544880#544880]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]