在此示例中,应用程序选择让事件侦听器将连接事件记录到应用程序的日志记录系统中:
public class ApplicationEventListener implements
com.sun.messaging.jms.notification.EventListener {
public void onEvent ( com.sun.messaging.jms.notification.Event connEvent ) {
log (connEvent);
}
private void log ( com.sun.messaging.jms.notification.Event connEvent ) {
String eventCode = connEvent.getEventCode();
String eventMessage = connEvent.getEventMessage();
//write event information to the output stream.
}
}