-
1. Re: The external Trigger makes the transition from subprocess node to the next node while subprocess is active.
swiderski.maciej Jun 18, 2010 9:47 AM (in response to felixkjose)Hi,
this is incorrect behavior and it was already fixed in 4.4, please take a look at following issue: https://jira.jboss.org/browse/JBPM-2874
-
2. Re: The external Trigger makes the transition from subprocess node to the next node while subprocess is active.
felixkjose Jun 21, 2010 1:34 AM (in response to swiderski.maciej)Hi Maceij,
Thank you for your reply. The JBPM-2874, the test case "testSubProcessWithStateFailure" is making the transition from the subprocess node to the next node using the main process instance id while the subprocess is in "wait" state. And then checking the process stateagainst the subprocess state. And my doubt is why the JBPM is not throwing any exception? Because
- The sub process is in active state(wait state).
- The main process is not making the transition over the sub process nodes.
So whether only a state check will do the solution or make a change in the implementation class of executionService's "signalExecutionById" method to check the subprocess instance is active or not and throw an exception saying the "Invalid transition. Subprocess [subprocess id =<Sub 19>] is active." while the sub process is active.
And should not able to transition from sub process node to next node.
Please let me know about your thoughts on the same.
By using ExecutionImpl I am getting the subprocess Id and using that I am able to transition through the subprocess nodes.
ExecutionImpl subExecutionImpl = executionImpl.getSubProcessInstance();
executionService.signalExecutionById(subExecutionImpl.getId());
But please let me know how the ExecutionImpl will do the workaround?
Because by using the ExecutionImpl I can get the subprocessId and main processId. But when I am doing a transition (
executionService.signalExecutionById(executionImpl.getId()) ) from subprocess node to the next node, it is happening successfully, while the subprocess is active(wait). This is not the intended output.
The expected result in this case is "throw an exception saying the "Invalid transition. Subprocess [subprocess id =<Sub 19>] is active."
Please give me a reply regarding this as soon as possible.
Thank You and Regards,
Felix K Jose
- The sub process is in active state(wait state).
-
3. Re: The external Trigger makes the transition from subprocess node to the next node while subprocess is active.
rebody Jun 21, 2010 6:32 AM (in response to felixkjose)Sorry, Wrong again. Maciej please execute me.
I should look into patch. not only see the SubProcessSignalTest.java
The final version of testSubProcessWithStateFailure is here;
public void testSubProcessWithStateFailure() { deployJpdlXmlString(SUB_PROCESS_WITH_WAIT_STATE); deployJpdlXmlString(MAIN_PROCESS_SUB_EL_ID); Map<String, String> vars = new HashMap<String, String>(); vars.put("dynamic_subprocess", "SubProcessReview-1"); ProcessInstance processInstance = executionService.startProcessInstanceByKey("mainProcess", vars); try { processInstance = executionService.signalExecutionById(processInstance.getId()); fail("Should fail since signal was made on a process with subprocess stil active"); } catch (Exception e) { //expected exception since we are signaling main process while sub process is not finished assertTrue(e.getMessage().indexOf("has running subprocess") != -1); // clean up to let other tests execute executionService.signalExecutionById(processInstance.getSubProcessInstance().getId()); executionService.signalExecutionById(processInstance.getSubProcessInstance().getId()); processInstance = executionService.signalExecutionById(processInstance.getId()); } }
We can see if there is an active sub process ,there will be an exception. Thank you Maciej for correcting me.
-
4. Re: The external Trigger makes the transition from subprocess node to the next node while subprocess is active.
swiderski.maciej Jun 21, 2010 5:09 AM (in response to felixkjose)The fix will do what you expect. In case of signal of main process while sub process is still running it will throw an exception that main process is not active.
In addition, since 4.4 there will be API method exposing subprocess instance so you will not need to use internal classes to get hold of this information.