com.caucho.bam.actor
Interface ActorProxy


public interface ActorProxy

ActorProxy is a convenience API for sending messages to a specific Actors, which always using the actor's address as the "from" parameter.


Method Summary
 void close()
          Closes the proxy
 MessageStream getActorStream()
          Returns the stream to this client.
 java.lang.String getAddress()
          Returns the proxy's address used for all "from" parameters.
 MessageStream getClientStream()
          Returns the registered callback MessageStream.
 MessageStream getLinkStream()
          The ActorStream to the link.
 java.lang.String getTo()
          Returns the target actor's address used for all "to" parameters.
 boolean isClosed()
          Returns true if the proxy is closed
 void message(java.io.Serializable payload)
          Sends a unidirectional message to the target ActorHolder,
 java.io.Serializable query(java.io.Serializable payload)
          Sends a query information call (get) to an actor, blocking until the actor responds with a result or an error.
 java.io.Serializable query(java.io.Serializable payload, long timeout)
          Sends a query information call (get) to an actor, blocking until the actor responds with a result or an error.
 void query(java.io.Serializable payload, QueryCallback callback)
          Sends a query information call (get) to an actor, providing a callback to receive the result or error.
 void setClientStream(MessageStream clientStream)
          Registers a callback MessageStream with the client
 void setLinkStream(MessageStream linkStream)
          Sets the ActorStream to the link.
 

Method Detail

getAddress

java.lang.String getAddress()
Returns the proxy's address used for all "from" parameters.


getTo

java.lang.String getTo()
Returns the target actor's address used for all "to" parameters.


message

void message(java.io.Serializable payload)
Sends a unidirectional message to the target ActorHolder,

Parameters:
payload - the message payload

query

java.io.Serializable query(java.io.Serializable payload)
Sends a query information call (get) to an actor, blocking until the actor responds with a result or an error. The target actor of a queryGet acts as a service and the caller acts as a client. Because BAM Actors are symmetrical, all Actors can act as services and clients for different RPC calls. The target actor MUST send a queryResult or queryError to the client using the same id, because RPC clients rely on a response.

Parameters:
payload - the query payload

query

java.io.Serializable query(java.io.Serializable payload,
                           long timeout)
Sends a query information call (get) to an actor, blocking until the actor responds with a result or an error. The target actor of a queryGet acts as a service and the caller acts as a client. Because BAM Actors are symmetrical, all Actors can act as services and clients for different RPC calls. The target actor MUST send a queryResult or queryError to the client using the same id, because RPC clients rely on a response.

Parameters:
payload - the query payload
timeout - time spent waiting for the query to return

query

void query(java.io.Serializable payload,
           QueryCallback callback)
Sends a query information call (get) to an actor, providing a callback to receive the result or error. The target actor of a queryGet acts as a service and the caller acts as a client. Because BAM Actors are symmetrical, all Actors can act as services and clients for different RPC calls. The target actor MUST send a queryResult or queryError to the client using the same id, because RPC clients rely on a response.

Parameters:
to - the target actor's address
payload - the query payload
callback - the application's callback for the result

setClientStream

void setClientStream(MessageStream clientStream)
Registers a callback MessageStream with the client


getClientStream

MessageStream getClientStream()
Returns the registered callback MessageStream.


getActorStream

MessageStream getActorStream()
Returns the stream to this client.


getLinkStream

MessageStream getLinkStream()
The ActorStream to the link.


setLinkStream

void setLinkStream(MessageStream linkStream)
Sets the ActorStream to the link.


isClosed

boolean isClosed()
Returns true if the proxy is closed


close

void close()
Closes the proxy