Creating WorkItem Handler and adding as dependency For JBPM

Posted By Mohit Shakya | 31-Jan-2018

Hi Audience,
Today I'll brief you about how to create work item handler and it's use in JBPM workflow.

Before this I need to brief you about JBPM.

jBPM is a flexible Business Process Management (BPM) suite. It's a bridge between business analysts and developers. Traditional BPM suites have an engine, which is limited to the attention of non-technical personnel. jBPM has two key points: the management functions manage business users and another is for developers. It is provided by RedHat Company.

Basically 'WorkItemHandler' is an interface in JBPM for task execution. It can be used as the dependency for jbpm task.
Using workItemHandler we can easily shift a whole java code workflow as an independent task.

package com.sample;

import org.kie.api.runtime.process.WorkItem;
import org.kie.api.runtime.process.WorkItemManager;

public class Test implements WorkItemHandler{
	@Override
	public void abortWorkItem(WorkItem arg0, WorkItemManager arg1) {
		System.out.println("Aborting process...");
	}

	@Override
	public void executeWorkItem(WorkItem arg0, WorkItemManager arg1) {
		System.out.println("Executing process...");
	}
}

To use above snippate as dependency for a task go through following steps:

  1. Create jar of above workItemHandler
  2. Updload it in artifact repository of 'KIE-workbench'
  3. Now, in your existing project just add this artifact as dependancy.
  4. Now, in your KIE-workbench add declaration of this workItemHandler class in KIE knowledge base.
  5. Now, add the declaration to WorkItemDefinition file and assign it a name.
  6. Now, this workItemHandler will be displayed in your BPM workflow as a task in right side tool bar.

Now you can use this as a task in your workflow.

I hope this'll be helpful for you.

Thank You.

 

Request for Proposal

Recaptcha is required.

Sending message..