AnsweredAssumed Answered

5.17 Async ServiceTask with later receiveTask signal not working

Question asked by njames on Jun 30, 2015
Latest reply on Jul 1, 2015 by njames
Hi,
Sorry if this is a FAQ, but I haven't been able to find an answer in the forum yet.
I am updating our existing app from Activiti 5.15.1 to 5.17.0. A result of this upgrade is that I am unable to make the async-continuations work as I thought they should.

We use the following construct to have a long running service task (actually a camel route):

    <serviceTask id="longRunningTask" name="Run Camel Route" activiti:async="true" activiti:type="camel"></serviceTask>
    <sequenceFlow id="flow2" sourceRef="longRunningTask" targetRef="receiveTask"></sequenceFlow>
    <receiveTask id="receiveTask" name="Wait for confirmation of camel route finishing"></receiveTask>

Then we have a Camel route

      this.from("activiti://asyncTest:longRunningTask?copyVariablesFromProperties=true")
         .routeId("asyncTest:longRunningTask")
         // Do some long running type task here!
         .log(LoggingLevel.DEBUG, "Releasing process")
         // Release the receive task now….
         .to("activiti://asyncTest:receiveTask?copyVariablesFromProperties=true");


This worked like a charm with the older version of Activiti, but with the new version it says:

Stacktrace
—————————————————————————————————————————————
java.lang.RuntimeException: Couldn't find activity receiveTask for processId 7 in defined timeout.
   at org.activiti.camel.ActivitiProducer.signal(ActivitiProducer.java:123)
   at org.activiti.camel.ActivitiProducer.process(ActivitiProducer.java:65)
   at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
   at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:113)


I have tried with the configuration recommended for using the old JobExecutor given in the release notes. When that didn't work, I used the new AsyncExecutor with similar (bad) results.

In my unit test, using 5.17.0, I find it interesting that the activityId of the processInstance is still set to longRunningTask after the startProcessInstanceByKey call. I was expecting that it would have moved to "receiveTask" before passivating.

Sorry for the rambling, I hope someone can give me a nudge in the right direction.

Outcomes