来自Camel Receive Task的Activiti抛出错误“ActivitiIllegalArgumentException:Business key is null”

时间:2013-08-19 11:28:58

标签: java spring integration apache-camel activiti

请分享任何用camel配置activiti的链接。我可以获得的所有示例都显示SERVICETASK-> CAMELROUTE-> FILE,然后显示FILE-> RECIEVETASK(Activiti)

这涉及一些BUSINESS_KEY,我无法弄清楚究竟是什么

我需要一个显示SERVICE TASK的示例 - > CAMEL ROUTE-> RECEIEVTASK(发出Activiti信号)。我不知道为什么,但这个例子给我错误

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的-骆驼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>

错误是:

 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)

所有具有ACTIVITI-&gt; CAMELROUTE(FILE)的论坛/链接  在其他路线CAMEL_FILE-&gt; RECIEVETASK

他们建议添加一些关键字,如PROCESS_KEY_PROPERTY或PROCESS_ID_PROPERTY 我不知道这些属性适合

我正在尝试从链接上的示例开始 http://bpmn20inaction.blogspot.in/2013/03/using-camel-routes-in-activiti-made.html

我不确定在给骆驼服务任务后是否进行过程,根本没有移动接收任务并在那里等待或者CAMEL无法找到接收任务

请分享一些关于此的建议

由于

2 个答案:

答案 0 :(得分:0)

它通过添加内置的camel队列来工作,如示例所示。我认为他们只是作为各种路线的例子。但实际上,通过传递到队列,ServiceTask在camel中是异步的,后来从队列中读取并调用了activiti中的接收任务

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

由于

答案 1 :(得分:0)

我不知道你是否解决了这个问题,但实际上我遇到了同样的问题。

最后,我找到了问题的解决方案。

事实上,必须提供PROCESS_ID_PROPERTY属性是正确的,否则激活引擎不知道执行哪个流程实例。因此,我只是在将JMS发送到activemq时在标头中设置PROCESS_ID_PROPERTY值,并且当消息返回时,只需从标头设置属性。有点像:

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");

希望它会对你有所帮助。