Book Image

Mastering jBPM 5

By : Simone Fiorini, Arun V Gopalakrishnan
Book Image

Mastering jBPM 5

By: Simone Fiorini, Arun V Gopalakrishnan

Overview of this book

If you are a designer or developer who wants to build and operate business process-centric applications, then this book is for you. Knowledge of the basic concepts of application development in Java will be helpful in following the concepts covered in the book, but is not necessary.
Table of Contents (13 chapters)
12
Index

Creating custom workitem handlers


In order for jBPM to access services of other components in the application, we can use the workitem handler extension point provided by jBPM. Workitem handlers are used to specify domain-specific services to a BPMN activity. There are several inbuilt generic workitem handlers prebuilt in jBPM.

For creating a workitem handler, we have to implement the org.kie.runtime.instance.WorkItemHandler interface. This interface holds two methods to be implemented:

  • WorkItemManager.completeWorkItem(long workItemId, Map<String, Object> results)

  • WorkItemManager.abortWorkItem(long workItemId)

A custom workitem has to be registered to the engine by using the workitem manager. For example, for registering a customer task, we can use the following:

ksession.getWorkItemManager().registerWorkItemHandler("Notification",
new NotificationWorkItemHandler());

In conclusion, we have discussed the provisions available in jBPM for integrating it with generic software architecture...