-
1. Re: working with executions
swiderski.maciej Mar 24, 2010 10:08 AM (in response to clauss)Hi,
In my opinion you should not signal when execution is in task. You should complete your task. To do so you use TaskQuery (constructed via TaskService) and once you find a task assigned for a user you can complete task using completeTask method on Task instance.
Take a look at examples delivered with jBPM distribution regarding tasks.
Cheers,
Maciej
-
2. Re: working with executions
clauss Mar 24, 2010 10:29 AM (in response to swiderski.maciej)Hi Maciej,
first: thanks for your response. In my understanding the TaskService is for human interaction. But that's not what I want to do. I want to finish a "BPMN 2.0 receiveTask". The documentation says this:
Process execution will wait in such a receive task. The process can then be continued using the familiar jBPM signal methods. Note that this will probably change in the future, since a 'signal' has a completely different meaning in BPMN 2.0.
As a code sample they provided this java snippet:
Execution execution = processInstance.findActiveExecutionIn("receiveTask"); executionService.signalExecutionById(execution.getId());
This is the xml snippet:
<receiveTask id="receiveTask" name="wait" />
The documentation says, that I can continue the process if I "signal" it. So I don't want to assign a task to a user or something. So my question is still open.
Best regards - Claus
-
3. Re: working with executions
swiderski.maciej Mar 24, 2010 10:54 AM (in response to clauss)I was expecting that you will respond like this I was about to put a comment that it my post was more related to regular jpdl than BPMN...but pressed the button too early.
ok, perhaps the problem is that you reference old process instance?! signalExecution... method return processInstance object try your last assertion on that instead.
Cheers,
Maciej
-
4. Re: working with executions
clauss Mar 24, 2010 12:14 PM (in response to swiderski.maciej)Hi Maciej,
I think that's it. The following test worked:
@Test public void oneReceiveNode(){ //deploy process repositoryService.createDeployment().addResourceFromClasspath("one_receive_node.bpmn.xml").deploy(); //start instance ProcessInstance instance = executionService.startProcessInstanceByKey("bar"); Assert.assertNotNull(instance); //signal first execution Execution e1 = instance.findActiveExecutionIn("r1"); Assert.assertNotNull(e1); ProcessInstance instance2 = executionService.signalExecutionById(e1.getId()); Assert.assertTrue(instance2.isEnded()); }
That means a process instance will be "refreshed", if I do a execution on it? I don't find that intuitive... But okay -it works Thank you!
Best regards - Claus
-
5. Re: working with executions
swiderski.maciej Mar 24, 2010 2:38 PM (in response to clauss)Hi,
glad I could help.
Yes, the process instance will be reloaded since the execution was in wait state so process instance was persisted into data store, so the instance you had before is not valid any more.
I agree that it is not so visible when working with unit tests.
Cheers,
Maciej