Thursday, December 3, 2015

JBoss BPM Suite 6.2 - Adding custom node tasks to your project

For the astute JBoss BPM fan it will not have escaped you that the community has been hard at work putting together a lot of new features for the upcoming JBoss BPM Suite 6.2 release.

With the early internal Red Hat releases being made available, some of the testing I do around updating the array of demo projects we have has revealed a subtle change. It got me to thinking that I could point out a few of these tips and tricks to your as the product approaches delivery to the public.

It is a common occurrence that you might want to create a custom node type for your process. That would be a task in your process that does something so specific that you want to encapsulate it into a single standard node type for your organization to reuse. 
Figure 1: select deployment descriptor from editor.

Out of the box JBoss BPM Suite provides several examples of this, such as a Log task and an Email task. We showcase the Email task in our JBoss BPM Travel Agency Demo and up to product version 6.1 we would configure this in a CustomWorkItemHandler.conf file. This file was then put into the business central application (see the init.sh in the project for details) for global usage by all projects.

In the latest release this usage was removed, so one needs to have it added in the deployment descriptor file (kie-deployment-descriptor.xml), which can be added globally into the business central application or in each specific project. 

We will show you here how we added the Email task as a WIH to the JBoss BPM Travel Agency project using the provided UI tooling.
Figure 2: default work items.

1. Project editor
Open the project editor in Authoring -> Project Authoring -> Open Project Editor

2. Deployment descriptor
Select the editor from drop down menu, see figure 1.

3. Work item handlers
Scroll down to the section with the work item handlers, you will find a few pre-configured as shown in figure 2, but we need to add an Email handler.


Figure 3: add Email details.
4. Add Email handler
Using the +Add button, we can provide the details as shown in figure 3 to add our Email task. Be sure to add a Name, class to be called, and Resolver Type.

After doing this we can save the file using the top right menu, then build and deploy our project to test a successful booking which will then use the email task at the end of our process.

Once you have configured your deployment descriptor you can safely remove an CustomWorkItemHandler.conf files, if you need a reminder how to access the git repository externally to remove these files from your project, see my previous article on how to do that.
Looking to Automate your business?

This article should provide good insight into the use of a deployment descriptor to control your custom task needs in your process projects.