All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dojox.cometd.MessageListener Maven / Gradle / Ivy

There is a newer version: 1.9.65
Show newest version
// ========================================================================
// Copyright 2007 Dojo Foundation
// ------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at 
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================

package dojox.cometd;

import java.util.EventListener;

/**
 * Message Listener Interface.
 * 
 * Objects implementing this interface may listen for message deliverly events
 * by calling the {@link Client#addListener(EventListener)}.  The {@link Synchronous}
 * or {@link Asynchronous} nested interfaces may be used as a mixin to specify the style 
 * of delivery required.  If neither subtype is specified, then the {@link Bayeux} 
 * implementation may use either method.
 * 
 * @author gregw
 *
 */
public interface MessageListener extends EventListener
{
    /**
     * Called when a message is delivered to the client
     * @param msg TODO
     */
    public void deliver(Client fromClient, Client toClient, Message msg);
    
    /**
     * Subtype of MessageListener that requires synchronous message delivery.
     * The {@link Client} object is locked during the call to 
     * {@link MessageListener#deliver(Client, Client, Message)}, thus 
     * guaranteeing that only a single message will be delivered at once and 
     * in order of receipt.
     *
     */
    public interface Synchronous {};
    
    /** 
     * subtype of MesssageListener that requires asynchronous message delivery.
     * Calls to {@link MessageListener#deliver(Client, Client, Message)} may occur
     * in parallel and possible out of order.
     * 
     */
    public interface Asynchronous {};
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy