AnsweredAssumed Answered

Return value to service task that delegates to Camel

Question asked by engywook on Mar 1, 2013
Latest reply on Jun 1, 2015 by jean-charles.landron@soprasteria.com
Hi,
I have a service task that delegates to Camel, and the service task has 2 outbound flows.  I'd like the decision for which flow to take to be based on the result of the Camel route.  Is there a way to feed that result back to Activiti (i.e. to set a process variable or to some how make the Activiti process aware of the value)?
Here is the relevant part of my bpmn file.

<serviceTask id="task1" name="Service Task" activiti:delegateExpression="${camel}"></serviceTask>
<sequenceFlow id="flow1" name="Can continue" sourceRef="task1" targetRef="receivetask1">
  <conditionExpression xsi:type="tFormalExpression"><![CDATA[${result == true}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow2" name="Cannot continue" sourceRef="task1" targetRef="endevent1">
  <conditionExpression xsi:type="tFormalExpression"><![CDATA[${result != true}]]></conditionExpression>
</sequenceFlow>
Here's a simplified version of the Camel route.

from("activiti:processName:task1")
  .beanRef("beanName", "methodName") // returned value will be in the exchange body
  .setProperty("result").body();
I'm using Activiti 5.11 and Camel 2.10.3.
Thanks for the help

Outcomes