Skip navigation

JBPM5 provides the flexibility to extend the default process constructs with domain-specific extensions.

Here is a simple example that shows the usage of  a custom workitem.


This custom extension feature provides the ability to create a service task, a generic way to interact with external services (e.g., JMS, Web service etc).


How to install and run this example?

Start with the setup as shown in


This example has a bpmn file that has the custom WorkItem(sample.bpmn), two WorkItem configurations files (CustomWorkItem.conf and drools.rulebase.conf), WorkItem implementation class ( and test class (


These files can be imported into a 'HelloProcess' project as shown below.



ScreenHunter_04 Mar. 27 22.34.gif

After running the test class '', following results can be seen.

ScreenHunter_07 Mar. 27 23.24.gif

Here are the main steps involved in creating the custom WorkItem.


1.) Workitem definition: Create the definition of the workitem using properties that are name-value pairs in a file CustomWorkItem.conf.


import org.drools.process.core.datatype.impl.type.ObjectDataType;

import org.drools.process.core.datatype.impl.type.StringDataType;




    "name" : "HelloProcessExtension",

     "icon" : "icons/action.gif",

    "displayName" : "HelloProcessExtension"



This definition file (CustomWorkItem.conf) is located in META-INF directory.



2.) WorkItem registration:

The definition of the workitem (CustomWorkItem.conf) needs to be registered in a project. It can be done by including the definition using the drools.WorkDefinitions property in a file drools.rulebase.conf in META-INF dircectory.


drools.workDefinitions = CustomWorkItem.conf WorkDefinitions.conf


3.) After creating a definition and registering the workitem, it will show up in designer. The Eclipse might need to be restarted after creating the configuration files in Step1 and Step2 (i.e, CustomWorkItem.conf and drools.rulebase.conf files in META-INF directory of the project)

The new workitem 'HelloProcessExtension' can be seen in 'Service Tasks' as shown below.

ScreenHunter_03 Mar. 27 22.34.gif

'HelloProcesExtension' node can be created inside the process using drag and drop.


4.) A WorkItemHandler implementation class needs to be created for the 'HelloProcessExtension' node.


ScreenHunter_05 Mar. 27 23.12.gif

5.) The WorkItemHandler should be registered at the WorkItemManager, using API as shown below (in

ScreenHunter_06 Mar. 27 23.15.gif

Filter Blog

By date:
By tag: