Camunda with Camel

I’m working on a project implementing Apache Camel integration framework. I’ve been trying to use Camunda as an integration end point. I’m pretty new to Camunda, but i found an extension here: https://github.com/camunda/camunda-bpm-camel There is also a good example here: https://github.com/camunda/camunda-consulting/tree/master/showcases/camel-use-cases The problem is that the example uses JBoss and CDI, while our platform uses Tomcat and Spring.

The example triggers a Camel route when a file is dropped in particular directory. The route then starts a new Camunda process. I’ve run the example and the Camel portion works. I can see in the logs that it detects the file’s existence and processes it. However, when I run Camunda Cock Pit, it does not show the process as being started.

I am hoping that someone could see anything that i’m missing. Thanks.

Hi @red_storm,

is your code available somewhere on github?

Cheers,
Askar

@red_storm
Add your camunda db connection as following in the camel-context xml file.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="org.postgresql.Driver" />
            <property name="url" value="jdbc:postgresql://localhost:5432/camunda" />
            <property name="username" value="postgres" />
            <property name="password" value="postgres" />
</bean>

Start Process as following. Define process definition key your bpmn file. In the following example CamelProcessStart is the camunda process definition key.

<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
           <route id="startRoute">
               <from uri="timer://simpleTimer?period=60000" />
               <camel:setBody>
                       <camel:simple>${body}</camel:simple>
               </camel:setBody>  
               <to uri="camunda-bpm://start?processDefinitionKey=CamelProcessStart&amp;copyBodyAsVariable=var1" />
            </route>
</camelContext>

Still if you have issues share your camel context file and bpmn file,

Here’s an example illustrating how to use Camunda with the Camel add-on for JBoss/WildFly. Integration takes advantage of Apache Camel and Wildfly’s new Artemis JMS implementation.

Straight Through Process with Camunda BPM and Apache Camel

Runs with the latest Camunda v7.6.0-alpha4 build and Wildfly-Camel (add-on) v4.2.1.

1 Like

Hi Gary,

Could you please help me in below scenario:

I have 3 separate micro services which have camunda engine and application on it. All there micro services are no 3 different servers. and camunda DB is shared between all of three. Now I have configured JMS which is having listeners whicha re continuously looking for requests. we have around 200 requests in queue in every 2 mins. currently we are facing issue as my first server get crashed due to higher CPU utilization. where as remaining 2 are normal. How do I make sure that all three sharing same load. I am using camel route as below:



and JMS configuration as below:




<bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
	init-method="start" destroy-method="stop">
	<property name="maxConnections" value="-1" />
	<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>

<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
	<property name="connectionFactory" ref="pooledConnectionFactory" />
	<property name="concurrentConsumers" value="20" />
</bean>

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
	<property name="configuration" ref="jmsConfig" />

Please guide me here.

Regards,
Amol

Is this before or after Camunda picks up the event?

If this is before Camunda starts working on the event then your ActiveMQ, as long as it’s still safely running on a still-standing’ server, should take care of this for you. The ‘crashed’ host should not have committed the msg-transaction, so it’ll release hold on the transaction and allow another ActiveMQ client to get the waiting message from the queue.

If this is after Camunda begins working on the event?
Because clustered Camunda hosts generally share a DB, the other Camunda hosts should simply pick the waiting event from the DB via the "job executor"

Recommend actually modeling the transaction in BPMN if it holds business-relevant information.