Announcing Mule’s Activiti transport

Hi all!
A couple of weeks ago I started the integration between Mule ESB and Activiti BPMN. Activiti is a Business Process Management (BPM) and workflow system targeted at business people, developers and system admins. Its core is a super-fast and rock-solid BPMN 2 process engine for Java. It’s open-source and distributed under the Apache license. Activiti is being written from the ground up with the requirement that the engine should be easily embedded and that the project would be aimed at developers not the business. This is a very natural fit for MuleSoft since our approach to middleware starts with the developer. We have been working with the Activiti guys since July focusing in the integration aspects of the project.

The idea behind Mule’s Activiti transport is that you are able to perform several administrative actions in an Activiti server from Mule. For example, let’s suppose that you would like to retrieve the candidate tasks of the user kermit, do some processing and CLAIM a subset of those tasks. The following configuration will work for you:

[sourcecode language=”xml”]
<activiti:connector name="actServer"
activitiServerURL="http://localhost:8080/activiti-rest/service/"
username="kermit" password="kermit" />

<model>
<service name="Activiti service">
<inbound>
<activiti:inbound-endpoint activiti-server="actServer">
<activiti:list-candidate-tasks user="kermit" />
</activiti:inbound-endpoint>
</inbound>

<component class="org.mule.transport.activiti.SelectTaskComponent" />

<outbound>
<multicasting-router>
<vm:outbound-endpoint path="out" connector-ref="asynchVm" />
<activiti:outbound-endpoint activiti-server="actServer" >
<activiti:perform-task-operation operation="CLAIM" />
</activiti:outbound-endpoint>
</multicasting-router>
</outbound>
</service>
</model>
[/sourcecode]

We next describe each part of the configuration, but for those of you who are familiar with Mule, the configuration is pretty straightforward.

Let’s start with the basics; for configuring the transport you need a connector. The connector will hold all the information related with the Activiti server such as server URL, administrative user and password, e.g:

[sourcecode language=”xml”]
<activiti:connector
name="actServer"
activitiServerURL="http://localhost:8080/activiti-rest/service/"
username="kermit"
password="kermit" />
[/sourcecode]

Then you can configure an inbound endpoint for polling information from the Activiti server. For example the following endpoint polls the list of candidate tasks of the user pablo.

[sourcecode language=”xml”]
<activiti:inbound-endpoint activiti-server="actServer">
<activiti:list-candidate-tasks user="pablo" />
</activiti:inbound-endpoint>
[/sourcecode]

Finally, you can execute operations in the outbound endpoints. For example, the following endpoint executes the operation claim over the task that comes inside the message. The payload of the message must be a map which must contain a task id and a operation. If the operation inside the map is null then the default operation configured in the endpoint is used.

[sourcecode language=”xml”]
<activiti:outbound-endpoint activiti-server="actServer" >
<activiti:perform-task-operation operation="CLAIM" />
</activiti:outbound-endpoint>
[/sourcecode]

For further examples please check the following configuration files in the SVN:

You can obtain a snapshot version of the transport from here. Currently the transport has been tested with Mule 2.2.6 and shortly with Mule 3.0.

In future releases we plan to cover more operations that could be perform on the server and let the user provide custom spring beans for operations that are not covered by the implementation.

Looking forward to hearing your comments!

2 thoughts on “Announcing Mule’s Activiti transport

  1. hi i have tried to test your mule example but i got this exception:
    ERROR 2014-01-14 15:16:33,248 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.mulesoft.org/schema/mule/activiti-remote]
    Offending resource: URL [file:/home/wfamaya/mulews/.mule/apps/activiti/activiti.xml]

    please help me to fix that

    1. Hi Wilson,
      As far as I know, the module has change a bit. You can contact Eugene Berman from Mulesoft and he will be able to assist you
      Thanks
      Esteban

Leave a Reply

Your email address will not be published. Required fields are marked *