next up previous contents
Next: MembershipListener Up: Interfaces Previous: Transport   Contents

MessageListener

Contrary to the pull-style of channels, some building blocks (e.g. PullPushAdapter) provide an event-like push-style message delivery model. In this case, the entity to be notified of message reception needs to provide a callback to be invoked whenever a message has been received. The MessageListener interface below provides a method to do so:

    public interface MessageListener {
        public void receive(Message msg);
        byte[]      getState();
        void        setState(byte[] state);
    }

Method receive() will be called when a message is received. The getState() and setState() methods are used to fetch and set the group state (e.g. when joining). Refer to 3.7.10 for a discussion of state transfer.



Bela Ban 2002-11-16