We concentrate on two chat addicts, Alice and Bob, who love to chat deep into the night. Therefore they subscribe to the topic /Chat/Insomnia to receive all messages from like-minded chatters. Figure 12 shows class ChatMsg, which represents a possible message class for this application.
public class ChatMsg
implements java.io.Serializable
{
private String sender;
private String text;
public String getSender() { return sender; }
public String getText() { return text; }
public ChatMsg(String sender, String text) {
this.sender = sender; this.text = text; }
}