Activiti is a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system admins. However, its standard version doesn’t allow to integrate with your existing enterprise technologies (e.g. your JMS broker). In this post we will briefly explain how to integrate Activiti with JMS using Mule’s Activiti Module.
First, you will need to run Activiti in embedded mode inside your Mule application; it is pretty similar to run Activiti inside Spring. An example configuration is shown next; you will need to define your processEngineConfiguration and the service beans you can obtain from it:
Then you will also need to define your JMS broker; in our case we will use Active MQ:
Finally, your Mule’s Activiti connector:
We are ready!
For our example, let’s suppose we have a process for managing orders that waits for the approval of a manager:
The manager approves them by submitting a message to the JMS queue approveQueue. To resolve which process needs to be approved the message must contain the process id and the username which will be set in the approvedBy variable. For the sake of conciseness, we will create the process from Mule as shown next:
This process will start and wait for a message in the JMS queue to signal it. This can be easily solved from the Mule side by specifying a flow that reads from a JMS queue, sets the variable approvedBy and signal the process as shown next:
Want to see the full example? Check our git hub repository for Activiti examples. Hope you want to start integrating Activiti with your existing enterprise environment using Mule’s Activiti Module and I look forward to your comments.