-1

Please share any links to configure activiti with camel. All examples I could get were showing SERVICETASK->CAMELROUTE->FILE and then FILE->RECIEVETASK(Activiti)

This involves some BUSINESS_KEY, which I couldn't figure out what exactly is

I need an example showing SERVICE TASK -> CAMEL ROUTE-> RECEIEVTASK(Signal the Activiti). I dont know why but this example gives me error

file: activiti-flow.bpmn20.xml:

<process id="camelprocess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="servicetask1" name="Service Task" activiti:async="true" activiti:delegateExpression="${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>

activiti-camel-spring.xml

<bean id="camel" class="org.activiti.camel.CamelBehaviour">
    <constructor-arg index="0">
        <list>
            <bean class="org.activiti.camel.SimpleContextProvider">
                <constructor-arg index="0" value="camelprocess" />
                <constructor-arg index="1" ref="camelContext" />
            </bean>
        </list>
    </constructor-arg>
</bean>

<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>

Error is:

 1|ERROR|org.slf4j.helpers.MarkerIgnoringBase:161||||>> Failed delivery for (MessageId:    ID-viscx73-PC-49557-1376961951564-0-1 on ExchangeId: ID-viscx73-PC-49557-1376961951564-0-2). Exhausted after delivery attempt: 1 caught:       org.activiti.engine.ActivitiIllegalArgumentException: Business key is null 

at   org.activiti.engine.impl.ProcessInstanceQueryImpl.processInstanceBusinessKey(ProcessInstanceQueryImpl.java:87)
at org.activiti.camel.ActivitiProducer.findProcessInstanceId(ActivitiProducer.java:78)
at org.activiti.camel.ActivitiProducer.signal(ActivitiProducer.java:58)
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)

All forums/links that has ACTIVITI->CAMELROUTE(FILE) then in other route CAMEL_FILE->RECIEVETASK

And they suggest to add some key like PROCESS_KEY_PROPERTY or PROCESS_ID_PROPERTY I don't get where these properties fit into

I am trying to work it from example at link http://bpmn20inaction.blogspot.in/2013/03/using-camel-routes-in-activiti-made.html

I am not sure whether process after giving service task to camel, is not moving at all to receive task and waiting up there or CAMEL is unable to find receive task

Please share some suggestion on this

Thanks

Chakradhar K
  • 501
  • 13
  • 40

2 Answers2

0

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

Chakradhar K
  • 501
  • 13
  • 40
0

I don't know whether you'd solved the problem or not, but actually I faced the same problem.

And finally, I found a solution of the problem.

In fact, it is correct that PROCESS_ID_PROPERTY property must be provided otherwise the activiti engine doesn't know to execute which process instance. So, I just set PROCESS_ID_PROPERTY value in the header when sending the JMS to activemq, and when the message back, just set the propertiy from header. Something likes:

from("activiti:process:simpleCall").setHeader("PROCESS_ID_PROPERTY", simple("${property.PROCESS_ID_PROPERTY}")).to("activemq:queue:request");

from("activemq:queue:reply").setProperty("PROCESS_ID_PROPERTY", simple("${header.PROCESS_ID_PROPERTY}")).to("activiti:process:simpleReceive");

Hope it will help you.

Tonny Tc
  • 852
  • 1
  • 12
  • 37