[jBPM Users] - Re: [jBPM4] final state when async node is used
by ouaibsky
The pb is not on getting a reference on processinstance.
The pb is the final state value is not "complete".
It's a pb because depending of continue mode, you do not have the same final result, and it means you'll have to know the worlflow containe to make some test.
ex: just add the last assertEquals on provides AsynActivityTest:
public void testEndStateCompleted() throws Exception {
| ProcessInstance processInstance = executionService
| .startProcessInstanceByKey("helloworld");
| String pid = processInstance.getId();
| System.out.println(processInstance.getState());
| Thread.sleep(500);
|
| Job job = managementService.createJobQuery()
| .processInstanceId(pid)
| .uniqueResult();
| managementService.executeJob(job.getId());
|
| //processInstance = executionService.signalExecutionById(pid, "toHello3");
| Thread.sleep(500);
| assertEquals("completed", processInstance.getState());
| assertTrue(processInstance.isEnded());
| }
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254798#4254798
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254798
16 years, 7 months
[jBPM Users] - Re: workflow design about wait states
by mmusaji
This was my original problem... in real world I wont know how long to sleep for. I need to read the objects back but only once they have all been updated after a certain amount of time (which could be 2 seconds or 20 seconds).
When I use take("join"), I get org.jbpm.api.JbpmException: there is no transition join in activity(validate red request). But there is.
I use takeDefaultTransition() (no sleep in my unit test) I get StaleObjectStateException because my unit test and my workflow are out of sync. This was pointed out my JBarrez in one of my previous posts. The sleep in my unit test solved this problem.
If I don't use continue="exclusive" in the join, then my workflow doesn't continue past the join... just stops.
Do you know how the waitForSignal() and takeDefaultTransition() methods are affected (if at all) when used async? Using them normally like in the examples they work fine.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254794#4254794
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254794
16 years, 7 months
[jBPM Users] - Re: workflow design about wait states
by mmusaji
Would love to write a blog entry about this, get more involved with jboss and jbpm is my ultimate aim. I need to know what I'm talking about first! ;) Unfortunately... with work pressures etc its not always possible. We'll see...
Taking the "async" out it works fine, I can see the nodes and assert which one they should be in. When the custom nodes run in async, the unit test runs to completion quicker than the actual workflow completes (or vice versa not sure). So when I do:
| Execution execution = processInstance.findActiveExecutionIn("validate one request");
| assertNotNull(execution ); //FAILS
| String executionId = execution .getId();
| executionService.signalExecutionById(executionId);
|
The assertion fails. In my custom class I have the following line
| public void execute(ActivityExecution execution {
| //my code....
| execution.waitForSignal();
| }
|
|
| public void signal(ActivityExecution execution,
| String signalName,
| Map<String, ?> parameters) {
| execution.take(signalName);
| }
|
|
and they all implement ExternalActivityBehaviour. I have no idea what state these are in now.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254772#4254772
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254772
16 years, 7 months