FYI. I am trying async service tasks with parallel gateway, below is my xml: <blockcode> <?xml version="1.0" encoding="UTF-8"?> <definitions id="definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" targetNamespace="ActivitiDemo">
<process id="test_Parallel" name="The simple group deploy process">
I am using spring job executor, and set jobExecutorActivate to true. Below is my test case: <blockcode> @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/activiti-context.xml" }) public class ParallelServiceTasksWithXML extends SpringActivitiTestCase {
@Test public void testParallelWithXML() throws Exception { Thread workThread = new Thread(new Runnable() { public void run() { final String deploymentId = repositoryService.createDeployment().addClasspathResource("ParallelServiceTask.bpmn20.xml") .deploy().getId(); System.out.println("deployment id: " + deploymentId); ProcessInstance pi = runtimeService.startProcessInstanceByKey("test_Parallel"); System.out.println("pid: " + pi.getId()); System.out.println("end: " + pi.isEnded()); } }); workThread.start();
while (true) { ProcessInstance runningPi = runtimeService.createProcessInstanceQuery().processDefinitionId("test_Parallel").singleResult(); if (runningPi != null && runningPi.isEnded()) { break; } Thread.sleep(3 * 1000); System.out.println("still running"); } } } </blockcode> And the delegate java class is quite simple: <blockcode> public class OffTrafficService implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { System.out.println("start off traffic service task: " + Calendar.getInstance().get(Calendar.SECOND)); Thread.sleep(10 * 1000); System.out.println("off traffic get executed"); } } </blockcode>
From the test output, I can see both service tasks get executed in parallel, but the process instance can not get to the end point, this has really block me several hours, hope someone can help me Thanks a lot.