cancel
Showing results for 
Search instead for 
Did you mean: 

Camel integration

mas82
Champ in-the-making
Champ in-the-making
Hi All,

I followed this article http://bpmn20inaction.blogspot.co.uk/2013/03/using-camel-routes-in-activiti-made.html and the Activiti in action book to setup Activiti with Camel. The examples provided work fine but I wanted Camel to use an external ActiveMQ broker. I set this up like this:

<bean id="activemq"
        class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="tcp://somehost:60616"/>
</bean>

I wanted the message to be passed from Activiti to an external queue ("activemq:firstQueue"), from where it would be consumed by some application. This application would do some processing and put the message onto "activemq:secondQueue". From there the message would be routed back to Activiti:
My routes are:

from("activiti:process_camel:camelTask").to("seda:asyncQueue");
from("seda:asyncQueue").to("activemq:firstQueue");
from("activemq:secondQueue").to("seda:receiveQueue");
from("seda:receiveQueue").to("activiti:process_camel:receiveTask");

When I run a process instance using these routes I get this:

org.activiti.engine.ActivitiIllegalArgumentException: Business key is null

Is it possible to use an external ActiveMQ broker in this way with Activiti and Camel?
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Maybe that when the message is sent back to the ActiveMQ secondQueue the message headers or properties that include the process instance id are not there anymore? What's the message that is sent to the secondQueue?

Best regards,

mas82
Champ in-the-making
Champ in-the-making
Thanks for your reply.

I am sending a String message (a single variable from Activiti) using this setting: org.activiti.camel.impl.CamelBehaviorCamelBodyImpl.
I am able to monitor the messages' contents on the queues and within my ActiveMQ client which consumes the message and passes it on. On the very first queue the message body is set correctly, but no Activiti related properties are set. The only property set is Camel's breadcrumbId. Should I take any extra steps to make sure that Activiti properties (business key and/or process id - I don't remember the exact names) are set?

I also tried to use the CamelBehaviorDefaultImpl setting, with three variables set in Activiti, and still the only property set on the message that reaches the first queue is breadcrumbId.

Thanks,
Michal

trademak
Star Contributor
Star Contributor
In the Activiti code we do the following:

<blockcode>
Exchange ex = new DefaultExchange(camelContextObj);
ex.setProperty(ActivitiProducer.PROCESS_ID_PROPERTY, activityExecution.getProcessInstanceId());
</blockcode>

So you should be able to see that property on the Camel exchange. To get this property to ActiveMQ would be a Camel feature.

Best regards,

mas82
Champ in-the-making
Champ in-the-making
Thank you for your help, I haven't been able to find the reason for this so far, if I do I'll post here.

Thanks,
Michal