Notification events are produced when human tasks are escalated.
Business Process Choreographer provides functionality for handling escalations,
such as creating escalation work items or sending e-mails. You can create
notification event handlers to customize the way in which escalations are
handled.
Why and when to perform this task
To implement notification event handlers, you can use either the
NotificationEventHandlerPlugin interface, or you can extend the default com.ibm.task.spi.NotificationEventHandler
service provider interface (SPI) implementation class.
Complete the
following steps to create a notification event handler.
Steps for this task
- Write a class that implements the NotificationEventHandlerPlugin
interface or extends the NotificationEventHandler implementation class. This class can invoke the methods of other classes.
If you use the
NotificationEventHandlerPlugin interface, you must implement all of the interface
methods. If you extend the SPI implementation class, overwrite the methods
that you need.
This class runs in the context of a Java 2 Enterprise
Edition (J2EE) Enterprise JavaBeans (EJB) application. Ensure that this class
and its helper classes follow the EJB specification.
The plug-in is
invoked with the authority of the EscalationUser role. This role is defined
when the human task container is configured.
Tip: If you
want to call the HumanTaskManagerService interface from this class, do not
call a method that updates the task or the escalation that produced the event.
This action results in a database deadlock.
- Assemble the plug-in class and its helper classes into a JAR file.
If the helper classes are used by several J2EE applications,
you can package these classes in a separate JAR file that you register as
a shared library.
- Create a service provider configuration file for the plug-in in
the META-INF/services/ directory of your JAR file.
The configuration file provides the mechanism for identifying and
loading the plug-in. This file conforms to the Java 2 service provider interface
specification.
- Create a file with the name com.ibm.task.spi.plug-in_nameNotificationEventHandlerPlugin,
where plug-in_name is the name of the plug-in.
For example,
if your plug-in is called HelpDeskRequest (event handler
name) and it implements the com.ibm.task.spi.NotificationEventHandlerPlugin interface,
the name of the configuration file is com.ibm.task.spi.HelpDeskRequestNotificationEventHandlerPlugin.
- In the first line of the file that is neither a comment line
nor a blank line, specify the fully qualified name of the plug-in class that
you created in step 1.
For example, if your plug-in class is
called MyEventHandler and it is in the com.customer.plugins package,
then the first line of the configuration file must contain the following entry: com.customer.plugins.MyEventHandler.
Result
You have an installable JAR file that contains a plug-in that handles
notification events and a service provider configuration file that can be
used to load the plug-in. You can register API event handlers with a task
instance, a task template, or an application component.
Tip: You only have one eventHandlerName property
available to register both API event handlers and notification event handlers.
If you want to use both an API event handler and a notification event handler,
the plug-in implementations must have the same name, for example,
Customer as
the event handler name for the SPI implementation.
You can implement both
plug-ins using a single class, or two separate classes. In both cases, you
need to create two files in the META-INF/services/ directory
of your JAR file, for example, com.ibm.task.spi.CustomerNotificationEventHandlerPlugin and com.ibm.task.spi.CustomerAPIEventHandlerPlugin.
Package the plug-in implementation and the helper classes in a single
JAR file.
What to do next
You now need to install and register the plug-in so that it is available
to the human task container at runtime. You can register notification event
handlers with a task instance, a task template, or an application component.