com.caucho.bam.stream
Interface MessageStream

All Known Subinterfaces:
Actor, Broker, LinkActor, LinkBroker, Mailbox, ManagedActor, ManagedBroker
All Known Implementing Classes:
AbstractActor, AbstractBroker, AbstractBrokerStream, AbstractCloudActor, AbstractLinkBroker, AbstractManagedBroker, AbstractMessageStream, AbstractMessageStreamFilter, BamJmsService, BamLogService, BamMailService, BamPhpActor, BamPhpRootService, CacheDataActor, CacheDataTriadActor, CacheMnodeActor, CacheMnodeTriadActor, ClusterQueueActor, ClusterQueueTriadActor, ClusterStatService, DeployActor, DualSizeMailbox, FallbackMessageStream, GlobalCacheActor, HashMapBroker, HeartbeatActor, HempBroker, HmtpServlet, HmtpWebSocketContextWriter, HmtpWebSocketWriter, HmuxQueue, JmxService, JMXService, JmxServiceImpl, JsmpWebSocketWriter, LicenseActor, ManagerActor, MultiworkerMailbox, NetworkAddressActor, NotifyActor, NullActor, NullMessageStream, OutboundMessageStream, PassthroughBroker, PassthroughMailbox, QueryActorFilter, QueryMessageStreamFilter, RepositoryActor, ResinActor, ServerGatewayBroker, ServerLinkActor, ServerProxyBroker, SimpleActor, SkeletonActorFilter, VoteActor, WatchdogActor, XmppAgentStream, XmppBindCallback, XmppBrokerStream, XmppWriter

public interface MessageStream

Primary stream handling all message packets. Actors send packets to the Broker for delivery to other Actors. Messages are divided into two groups:


Method Summary
 java.lang.String getAddress()
          Returns the address of the ActorHolder at the end of the stream.
 Broker getBroker()
          Returns the owning broker
 boolean isClosed()
          Tests if the stream is closed.
 void message(java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a unidirectional message to an ActorHolder, addressed by the Actor's address.
 void messageError(java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a message error to an ActorHolder, addressed by the Actor's address.
 void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          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, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
          Sends a query error from a failed query.
 void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
          Sends a query response for a query
 

Method Detail

getAddress

java.lang.String getAddress()
Returns the address of the ActorHolder at the end of the stream.


isClosed

boolean isClosed()
Tests if the stream is closed.


getBroker

Broker getBroker()
Returns the owning broker


message

void message(java.lang.String to,
             java.lang.String from,
             java.io.Serializable payload)
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

messageError

void messageError(java.lang.String to,
                  java.lang.String from,
                  java.io.Serializable payload,
                  BamError 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,
           java.lang.String to,
           java.lang.String from,
           java.io.Serializable payload)
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,
                 java.lang.String to,
                 java.lang.String from,
                 java.io.Serializable payload)
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,
                java.lang.String to,
                java.lang.String from,
                java.io.Serializable payload,
                BamError 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
payload - the query payload
error - additional error information