com.caucho.bam.actor
Interface ActorSender

All Superinterfaces:
QuerySender
All Known Subinterfaces:
RemoteActorSender
All Known Implementing Classes:
AbstractActorSender, HmtpClient, HmuxClient, LocalActorSender, SimpleActorSender

public interface ActorSender
extends QuerySender

ActorSender is a convenience API for sending messages to other Actors, which always using the actor's address as the "from" parameter and manages query ids.


Method Summary
 void close()
          Closes the sender.
 Broker getBroker()
          The underlying broker.
 boolean isClosed()
          Returns true if the sender is closed
 void message(java.lang.String to, java.io.Serializable payload)
          Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.
 long nextQueryId()
          Returns the next query identifier.
 java.io.Serializable query(java.lang.String to, 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.lang.String to, java.io.Serializable payload, long timeout)
          Sends a query information call to an actor, blocking until the actor responds with a result or an error.
 void query(java.lang.String to, java.io.Serializable payload, QueryCallback callback)
          Sends a query information call (get) to an actor, providing a callback to receive the result or error.
 
Methods inherited from interface com.caucho.bam.query.QuerySender
getAddress, getQueryManager
 

Method Detail

isClosed

boolean isClosed()
Returns true if the sender is closed


close

void close()
Closes the sender.


getBroker

Broker getBroker()
The underlying broker.

Specified by:
getBroker in interface QuerySender

message

void message(java.lang.String to,
             java.io.Serializable payload)
Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.

Specified by:
message in interface QuerySender
Parameters:
to - the target actor's address
payload - the message payload

nextQueryId

long nextQueryId()
Returns the next query identifier.


query

java.io.Serializable query(java.lang.String to,
                           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.

Specified by:
query in interface QuerySender
Parameters:
to - the target actor's address
payload - the query payload

query

java.io.Serializable query(java.lang.String to,
                           java.io.Serializable payload,
                           long timeout)
Sends a query information call to an actor, blocking until the actor responds with a result or an error. The target actor of a query 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.

Specified by:
query in interface QuerySender
Parameters:
to - the target actor's address
payload - the query payload
timeout - time spent waiting for the query to return

query

void query(java.lang.String to,
           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.

Specified by:
query in interface QuerySender
Parameters:
to - the target actor's address
payload - the query payload
callback - the application's callback for the result