In order to subscribe to a DAC, a callback object implementing the Notifiable interface must be provided. Figure 14 shows how to implement a simple callback object for chat sessions.
public interface Notifiable {
public void notify(Object m);
}
public class ChatNotifiable
implements Notifiable
{
public void notify(Object m) {
/* elements are of type ChatMsg */
ChatMsg cm = (ChatMsg)m;
System.out.println("Message from " +
cm.getSender());
System.out.println(cm.getText());
}
}