![]() |
![]() |
|
|
Using Plug-In Notifications
This section explains how to use plug-in notifications. It includes the following topics:
Overview
BPM communicates with plug-ins by broadcasting notifications. A notification is a message that the WebLogic Integration process engine sends to a plug-in, indicating that an event has occurred, as illustrated in the following figure.
Figure 5-1 Notification Sent by WebLogic Integration Process Engine to Plug-In
You can register a plug-in as a notification listener to receive up to four types of notifications, provided as part of the com.bea.wlpi.server.plugin package. Note: To minimize the impact on performance, only register a plug-in for notifications that it absolutely needs to receive. In particular, use caution when registering to receive run-time instance and task notifications. The following table defines:
Table 5-1 Notification Types and Related Events
The following sections describe how to register and unregister the plug-in as a notification listener, and get information about a received notification.
Registering the Plug-In as a Notification Listener
Typically, the plug-in should register itself as a notification listener at load time. For example, when implementing the load() method, as described in Lifecycle Management Methods, you should register the plug-in as a notification listener, if necessary.
To register the plug-in as a notification listener, use one (or more) of the com.bea.wlpi.server.plugin.PluginManagerCfg methods defined in the following table, based on the type of notifications that you want the plug-in to receive.
Note: For information about connecting to the Plug-in Manager, see Connecting to the Plug-In Manager.
Table 5-2 Plug-In Notification Registration Methods
The following table defines the parameters for which you must specify values for the plug-in notification registration method.
Table 5-3 Plug-In Notification Registration Method Parameters
For more information about notification listener registration methods, see the com.bea.wlpi.server.plugin.PluginManagerCfg Javadoc.
The following code listing is an excerpt from the plug-in sample that shows how to register the plug-in as a notification listener for all notification types and all of their related events. This excerpt is taken from the SamplePluginBean.java file in the WLI_HOME/samples/bpm_api/plugin/src/com/bea/wlpi/tour/po/plugin directory. Notable lines of code are shown in bold.
Listing 5-1 Registering the Plug-In as a Notification Listener
.
.
.
public void load(PluginObject pluginData) throws PluginException {
.
.
.
pm.addInstanceListener(plugin, PluginConstants.EVENT_NOTIFICATION_ALL);
pm.addTaskListener(plugin, PluginConstants.EVENT_NOTIFICATION_ALL);
pm.addTemplateDefinitionListener(plugin,
PluginConstants.EVENT_NOTIFICATION_ALL);
pm.addTemplateListener(plugin, PluginConstants.EVENT_NOTIFICATION_ALL);
.
.
.
}
For more information about the plug-in sample, see BPM Plug-In Sample.
Getting Information About a Received Notification
Once a notification is received, you can get information about it, including its source.
The following table defines methods available for getting information about any received notification. These methods can be accessed via the com.bea.wlpi.server.plugin.PluginNotification class which all notification types extend.
Table 5-4 General Plug-In Notification Information Methods
For more information about these methods, see the com.bea.wlpi.server.plugin.PluginNotification Javadoc.
In addition, the following table defines the methods that are available to each notification type to obtain addition information about the source component that has changed.
Table 5-5 Plug-In Notification Information Methods Based on Notification Type
Unregistering the Plug-In as a Notification Listener
Typically, the plug-in should unregister itself as a notification listener at unload time. For example, when implementing the unload() method, as described in Lifecycle Management Methods, you should unload the plug-in as a notification listener, if necessary.
To unregister the plug-in as a notification listener, use one (or more) of the com.bea.wlpi.server.plugin.PluginManagerCfg methods defined in the following table, based on the type of notification listener that you want to remove.
Note: For information about connecting to the Plug-in Manager, see Connecting to the Plug-In Manager.
Table 5-6 Plug-In Notification Unregistration Methods
In each case, you must specify a com.bea.wlpi.server.plugin.Plugin object that identifies the plug-in that you are unregistering as a notification listener.
The following code listing shows how to unregister the plug-in as a notification listener for all notification types and all of their related events. Notable lines of code are shown in bold.
Listing 5-2 Unregistering the Plug-In as a Notification Listener
public void unload() throws PluginException {
.
.
.
pm.removeInstanceListener(plugin);
pm.removeTaskListener(plugin);
pm.removeTemplateDefinitionListener(plugin);
pm.removeTemplateListener(plugin);
.
.
}
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|