Adapter Development Kit 6.5 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Using the Sample Adapter | Phase 5: Adding Listener Notifications | Implementing the Listener
 
Implementing the Listener
The listener is a Sample Server client that has a connection in the passive listening mode. To define a listener, you extend the class com.wm.adk.notification.WmConnectedListener. The Sample Adapter includes the subclass as WmSampleListener in the com.wm.adapter.wmSampleAdapter.connection Java package. When this listener is configured, it will be able to connect and monitor the Sample Server for the occurrence of specified events.
Normally, a listener does not create its native connection to the back-end system. Instead, it calls the method retrieveConnection to retrieve a connection object that you specify when you configure the listener. In the waitForData method, the connection object will wait and return the notification event. If the listener times out, it returns null. The time out of the connection while in the blocked reading mode is an important feature of the connection object. It gives the adapter the opportunity to shut down the listener if it is disabled.