org.apache.cometd.bayeux
Interface Client

All Known Implementing Classes:
ClientImpl

public interface Client

A Bayeux Client.

A client may subscribe to channels and publish messages to channels. Client instances should not be directly created by uses, but should be obtained via the Bayeux.getClient(String) or Bayeux.newClient(String, Listener) methods.

Three types of client may be represented by this interface:

  • The server representation of a remote client connected via HTTP, automatically created by the Bayeux server when a connect message comes in
  • A server side client, created by the application using the Bayeux.newClient(String, Listener) method
  • A java client connected to a remote Bayeux server - not implemented
  • Author:
    Greg Wilkins, Filip Hanik

    Method Summary
     void deliver(Message message)
              Deliver a message to this client only Deliver a message directly to the client.
     void deliver(Message[] message)
              Deliver a batch of messages to this client only Deliver a batch messages directly to the client.
     void endBatch()
              Ends a batch. since batches can be nested, messages will only be delivered after the endBatch has been called as many times as startBatch has.
     java.lang.String getId()
              Returns a unique id for this client.
     boolean hasMessages()
              Returns true if this client is holding messages to be delivered to the remote client.
     boolean isLocal()
               
     void startBatch()
              Starts a batch, no messages will be delivered until endBatch is called.
     

    Method Detail

    getId

    java.lang.String getId()
    Returns a unique id for this client. The id is unique within this Bayeux session.

    Returns:
    String - will not be null

    hasMessages

    boolean hasMessages()
    Returns true if this client is holding messages to be delivered to the remote client. This method always returns false for local clients, since messages are delivered instantly using the Listener(callback) object

    Returns:
    boolean

    deliver

    void deliver(Message message)
    Deliver a message to this client only Deliver a message directly to the client. The message is not filtered or published to a channel.

    Parameters:
    message -

    deliver

    void deliver(Message[] message)
    Deliver a batch of messages to this client only Deliver a batch messages directly to the client. The messages are not filtered or published to a channel.

    Parameters:
    message -

    isLocal

    boolean isLocal()
    Returns:
    True if the client is local. False if this client is either a remote HTTP client or a java client to a remote server.

    startBatch

    void startBatch()
    Starts a batch, no messages will be delivered until endBatch is called. Batches can be nested, and messages will only be delivered after the last endBatch has been called.


    endBatch

    void endBatch()
    Ends a batch. since batches can be nested, messages will only be delivered after the endBatch has been called as many times as startBatch has.



    Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.