Work Item Handlers - redhat-consulting/jbpm-ee GitHub Wiki
###What is a Work Item Handler?###
A Work Item Handler is a piece of code that is executed within your workflow. To leverage a Work Item Handler within your workflow, the first step is to implement the org.kie.runtime.instance.WorkItemHandler
interface within the Kjar project.
###How to Use Work Item Handlers in a Workflow###
Once you have created the Work Item Handler, to leverage it with your workflow, the Work Item Handler needs to be registered to the WorkDefinitions.wid
located in the KJar's /src/main/resources/META-INF/
folder.
Find an example of registering Work Item Handlers within the JBPM EE Kjar Sample
##Registering Work Item Handlers## The jBPM-EE project loads the Work Item Handler from a file [WorkDefinitions.wid] in the KJar's META-INF directory. The file needs to register all Work Item Handlers leveraged by the workflow.
[
[
"name" : "Custom Handler",
"displayName" : "Custom Handler",
"defaultHandler" : "org.jbpm.ee.test.TestHandler",
"dependencies" : [
]
]
]
Make sure you specify the "defaultHandler" property, which should map to the class you want to implement for the Work Item Handler, as seen in the example.
kjarApp |____pom.xml |____src | |____main | | |____java | | | |____barpackage | | | | |____LoanOrder.java | | | | |____TestHandler.java | | |____resources | | | |____META-INF | | | | |____drools.rulebase.conf | | | | |____kmodule.info | | | | |____kmodule.xml | | | | |____WorkDefinitions.wid | | | |____testTaskProcess.bpmn2 | | | |____testWorkItemProcess.bpmn2