title: REST API to start a process instance is holding request until process instance is complete
body: <p>I'm using Activiti version 6.</p>
  
  <p>I created a BPMN process from activiti-app.<br>
  Then I want to start that process from <em>activiti-rest.war</em> using the API.</p>
  
  <pre><code>http://localhost:8080/activiti-rest/service/runtime/process-instances
  
  request body :
  
   {
  
     "processDefinitionKey":"cep_dispatch_process",
     "businessKey":"myBusinessKey",
       "returnVariables": false
  }
  
  header :
  Content-Type:application/json
  </code></pre>
  
  <p>As I see in the LOG process is being started in tomcat threads.
  referring latest GitHub code:</p>
  
  <pre><code>Activiti-activiti-6.0.0\modules\activiti-rest\src\main\java\org\activiti\rest\service\api\runtime\process\ProcessInstanceCollectionResource.java
  </code></pre>
  
  <p>When I see method,           </p>
  
  <pre><code>@RequestMapping(value = "/runtime/process-instances", method = RequestMethod.POST, produces = "application/json")
    public ProcessInstanceResponse createProcessInstance(@RequestBody ProcessInstanceCreateRequest request, HttpServletRequest httpRequest, HttpServletResponse response) {
  </code></pre>
  
  <p>I can see process is being started  and not waiting for process to complete, HTTP response is 201. I can understand request is not being hold for process instance to complete.</p>
  
  <pre><code>instance = processInstanceBuilder.start();
  
  response.setStatus(HttpStatus.CREATED.value());
  </code></pre>
  
  <p>Please refer the log snipped below, I can see process is executing in server thread and request is waiting till process completed.</p>
  
  <pre><code>276-DEBUG 17-01-2019 14:12:07,177- (http-nio-8080-exec-3) ExecutionEntityManagerImpl: Child execution Execution[ id '130023' ] - parent '130021' created with parent 130021
  241-DEBUG 17-01-2019 14:12:07,178- (http-nio-8080-exec-3) ContinueProcessOperation: Executing boundary event activityBehavior class org.activiti.engine.impl.bpmn.behavior.BoundaryTimerEventActivityBehavior with execution 130023
  171-DEBUG 17-01-2019 14:12:07,202- (http-nio-8080-exec-3) ContinueProcessOperation: Executing activityBehavior class org.activiti.engine.impl.bpmn.behavior.SubProcessActivityBehavior on activity 'sid-1A2A8DF5-764A-4960-8E5D-F347DC10207C' with execution 130021
  276-DEBUG 17-01-2019 14:12:07,203- (http-nio-8080-exec-3) ExecutionEntityManagerImpl: Child execution Execution[ id '130025' ] - parent '130021' created with parent 130021
  63-DEBUG 17-01-2019 14:12:07,203- (http-nio-8080-exec-3) DefaultActivitiEngineAgenda: Operation class org.activiti.engine.impl.agenda.ContinueProcessOperation added to agenda
  70-DEBUG 17-01-2019 14:12:07,203- (http-nio-8080-exec-3) CommandInvoker: Executing operation class org.activiti.engine.impl.agenda.ContinueProcessOperation 
  </code></pre>
  
  <p>Request must not wait for process to complete.</p>
  
  <p>How can I solve this, request to start the process must not wait for process-instance to complete.</p>
  
  <p>As you see in the response below:</p>
  
  <pre><code>{"id":"130028",
  "url":"http://localhost:8080/activiti-rest/service/runtime/process-instances/130028",
  "businessKey":"myBusinessKey",
  "suspended":false,
  "ended":true,
  "processDefinitionId":"cep_dispatch_process:13:125033",
  "processDefinitionUrl":"http://localhost:8080/activiti-rest/service/repository/process-definitions/cep_dispatch_process:13:125033"
  ,"processDefinitionKey":"cep_dispatch_process",
  "activityId":null,
  "variables":[],
  "tenantId":"",
  "name":null,
  "completed":true
  }
  </code></pre>
  
  <p>API is returning only after process completes, I add delay of 2 min in service task, I can see request will be waiting.</p>