com.caucho.amp.stream
Interface AmpStream

All Known Subinterfaces:
AmpActor, AmpMailbox
All Known Implementing Classes:
AbstractAmpActor, AbstractAmpMailbox, AbstractAmpStream, ActorContextImpl, AmpProxyActor, QueueMailbox, SimpleAmpMailbox

public interface AmpStream

Primary stream handling all messages. Messages are divided into two groups:


Method Summary
 void error(AmpActorRef to, AmpActorRef from, AmpEncoder encoder, AmpError error)
          Sends a message error to an ActorHolder, addressed by the Actor's address.
 void query(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.String methodName, java.lang.Object... args)
          Sends a query/RPCinformation call The receiver of a query acts as a service and the caller acts as a client.
 void queryError(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, AmpError error)
          Sends a query error from a failed query.
 void queryResult(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.Object result)
          Sends a query response for a query
 void send(AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.String methodName, java.lang.Object... args)
          Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.
 

Method Detail

send

void send(AmpActorRef to,
          AmpActorRef from,
          AmpEncoder encoder,
          java.lang.String methodName,
          java.lang.Object... args)
Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.

Parameters:
to - the target actor's address
from - the source actor's address
payload - the message payload

error

void error(AmpActorRef to,
           AmpActorRef from,
           AmpEncoder encoder,
           AmpError error)
Sends a message error to an ActorHolder, addressed by the Actor's address. Actor protocols may choose to send error messages if a message fails for some reason. In general, Actors should not rely on the delivery of error messages. If an error return is required, use an RPC query instead.

Parameters:
to - the target actor's address
from - the source actor's address
payload - the message payload
error - the message error

query

void query(long id,
           AmpActorRef to,
           AmpActorRef from,
           AmpEncoder encoder,
           java.lang.String methodName,
           java.lang.Object... args)
Sends a query/RPCinformation call The receiver 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 stream MUST send a queryResult or queryError to the client using the same id, because RPC clients rely on a response.

Parameters:
id - the query identifier used to match requests with responses
to - the service actor's address
from - the client actor's address
payload - the query payload

queryResult

void queryResult(long id,
                 AmpActorRef to,
                 AmpActorRef from,
                 AmpEncoder encoder,
                 java.lang.Object result)
Sends a query response for a query

Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
payload - the result payload

queryError

void queryError(long id,
                AmpActorRef to,
                AmpActorRef from,
                AmpEncoder encoder,
                AmpError error)
Sends a query error from a failed query.

Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
methodName - the name of the called method
error - additional error information