cancel
Showing results for 
Search instead for 
Did you mean: 

activiti camel gives Couldn't find activity receivetask1 for processId 9101

chakri_7
Champ in-the-making
Champ in-the-making
Hi

I have been trying to integrate camel-activiti with activiti process flow as

START->SERVICETASK(ROUTE TO CAMEL)->RECEIVETASK(EARLIER CAMEL ROUTE SIGNALS THIS TASK)->END

BPM:
<blockcode>
<process id="camelprocess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:async="true" activiti:type="camel"></serviceTask>
    <receiveTask id="receivetask1" name="Receive Task"></receiveTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="receivetask1"></sequenceFlow>
    <sequenceFlow id="flow3" sourceRef="receivetask1" targetRef="endevent1"></sequenceFlow>
  </process>
</blockcode>

CAMELROUTE-CONFIG:
<blockcode>
<camel:camelContext id="camelContext">
       <camel:route>
          <camel:from uri="activiti:camelprocess:servicetask1"/>
          <camel:to uri="bean:serviceActivator?method=doSomething(${body})"/>
          <camel:to uri="activiti:camelprocess:receivetask1"/>
       </camel:route>
    </camel:camelContext>
   
    <bean id="serviceActivator" class="com.test.CamelServiceActivator"/>
</blockcode>

When I debugged the activiti-camel jar I found at:ActivitiProducer.class,

private void signal(Exchange exchange) {
    String processInstanceId = findProcessInstanceId(exchange);
    Execution execution = runtimeService.createExecutionQuery()
        .processDefinitionKey(processKey)
        .processInstanceId(processInstanceId)
        .activityId(activity).singleResult();

    if (execution == null) {
      throw new RuntimeException("Couldn't find activity "+activity+" for processId " + processInstanceId);
    }

execution is null, and raising

||main|ERROR|org.slf4j.helpers.MarkerIgnoringBase:161||||>> Failed delivery for (MessageId: ID-viscx73-PC-50321-1376801958203-0-1 on ExchangeId: ID-viscx73-PC-50321-1376801958203-0-2). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Couldn't find activity receivetask1 for processId 9101
java.lang.RuntimeException: Couldn't find activity receivetask1 for processId 9101
   at org.activiti.camel.ActivitiProducer.signal(ActivitiProducer.java:65)
   at org.activiti.camel.ActivitiProducer.process(ActivitiProducer.java:49)
   at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
   at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
   at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
   at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
   at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)



Any suggestions please



2 REPLIES 2

chakri_7
Champ in-the-making
Champ in-the-making
Hi

It worked by adding inbuilt camel queues as shown in the example. I thought they were just shown as example for various routes. But by passing to queue actually the ServiceTask was made asynchronous in camel and later from queue they were read and invoked the receive task in activiti

    <camel:to uri="seda:tempQueue"/>
    <camel:from uri="seda:tempQueue"/>

Thanks

smirzai
Champ on-the-rise
Champ on-the-rise
Hi
With this patch you do not need that extra seda calling.
https://github.com/Activiti/Activiti/pull/126