Invoking a jBPM 6 Process from Camel Spring

The Camel jbpm component provides integration with Business Process Management (BPM) Suit jBPM 6. Behind the hoods It uses kie-remote-client API to interact with jBPM instance over REST. Let’s see an example of it:

Say you have the following process available from the business central of jBPM:

camel jbpm 6 integration

The following sample blueprint shows how you can invoke the above process definition:

<blueprint xmlns=""     xmlns:cm=""     xmlns:xsi="" xsi:schemaLocation="">       <camelContext id="blueprint-bean-context" xmlns="">         <route id="jbpm-route">             <from id="_from1" uri="timer://foo?fixedRate=true&amp;period=1000"/>             <setHeader headerName="CamelJBPMProcessId" id="_setHeader1">                 <constant>project1.simpleprocess</constant>             </setHeader>             <to id="_to1" uri="jbpm:;password=Password1!&amp;deploymentId=example:project1:1.0"/>         </route>     </camelContext> </blueprint> 

The above example uses the default operation, which is create new Process. Here is the list of available operations which you can pass via the operation parameter:

Process operations: startProcess, abortProcessInstance, signalEvent, getProcessInstance, getProcessInstances

Rule operations: fireAllRules, getFactCount, getGlobal, setGlobal

Work Item Operations: abortWorkItem, completeWorkItem

Task Operations: activateTask, addTask, claimNextAvailableTask, claimTask, completeTask, delegateTask, exitTask, failTask, getAttachment, getContent, getTasksAssignedAsBusinessAdministrator, getTasksAssignedAsPotentialOwnerByStatus, getTaskByWorkItem, getTaskBy, getTaskContent, getTasksByProcessInstance, getTasksByStatusByProcessInstance, getTasksOwned, nominateTask, releaseTask, resumeTask, skipTask, startTask, stopTask, suspendTask

Passing variables to the Process

Just as you would do with Java code, you can init a new jBPM process passing an HashMap of parameters:

<camelContext id="myContext"  xmlns="">     <route>         <from uri="direct:start"/>             <setHeader headerName="CamelJBPMProcessId">                                  <constant ref="maps" />                   </setHeader>                  </route> </camelContext>  <property name="maps">     <map>         <entry key="Param 1" value="1" />         <entry key="Param 2" value="2" />     </map> </property>