Adapter Development Kit 6.5 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Listener Notifications | Listener Classes
 
Listener Classes
You implement a listener class by extending the base class com.wm.adk.notification.WmConnectedListener, as shown by the SimpleListener class in the following figure.
Listener classes
Like other adapter components, the adapter's implementation class must support both design-time and run-time activities. Metadata parameters for listeners work exactly the same way as described for connections in webMethods Metadata Parameters. In addition, the implementation class is required to override the following methods:
Method
Description
fillWmDescriptor
Adds any display and data entry constraints to the listener's metadata parameters. From the standpoint of the adapter implementation, the model is identical to the connection model.
listenerStartup
Initializes the listener. This method is called during the listener startup sequence as well as during the recovery procedure after an AdapterConnectionException is encountered.
waitForData
Monitors the adapter resource. This method returns data that is analyzed by the supports method of associated listener notifications. For more details, see Listener and Listener Notification Interactions.
listenerShutdown
Cleans up listener resources. This method is called during the listener shutdown sequence.
Note:
To allow the listener implementation class to post-process listener notification results, you may optionally override the processNotificationResults method. For an example of using both methods, see Implementing Run-Time Code.
metadataVersion
Returns the current version of the metadata.
Note:
Override this method if the template has multiple metadata versions.
fieldsToIgnoreInMetadataDefinition
Uses metadata version as input and returns an array of the fields that are not applicable to the metadata version provided.
Note:
Override this method if the template has multiple metadata versions. Failing to override fieldsToIgnoreInMetadataDefinition results in breaking old services.
In addition, the implementation class may override the following optional methods:
Method
Description
restrictNotificationTypes
Allows the listener implementation class to restrict the notification classes it supports by explicitly identifying them. For more information, see Restricting Listeners to Register Specified Notification Templates.
shutdownCallBack
Invoked on a thread separate from the listener's thread, this method allows the listener's waitForData loop to be gracefully interrupted prior to a normal shutdown. For more information, see Implementing the shutdownCallBack() Method.