public class SkeletonActorFilter<T> extends java.lang.Object implements Actor
@Message
annotations to simplify
Actor development.
@Message
. To send
a response message or query, use getBrokerStream()
or
getClient()
.
Constructor and Description |
---|
SkeletonActorFilter(Actor next,
T actor) |
Modifier and Type | Method and Description |
---|---|
protected BamSkeleton<T> |
createSkeleton(T actor) |
java.lang.String |
getAddress()
Returns the Actor's address so the
Broker can
register it. |
Broker |
getBroker()
Returns the stream to the broker for query results or errors, or
low-level messaging.
|
boolean |
isClosed()
Tests if the stream is closed.
|
void |
message(java.lang.String to,
java.lang.String from,
java.io.Serializable payload)
Dispatches a unidirectional message to a matching method on
the SimpleActorStream.
|
void |
messageError(java.lang.String to,
java.lang.String from,
java.io.Serializable payload,
BamError error)
Dispatches a messageError to a matching method on
the SimpleActorStream.
|
void |
query(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable payload)
Dispatches a queryGet to a matching method on
the SimpleActorStream.
|
void |
queryError(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable payload,
BamError error)
Dispatches a queryError to a matching method on
the SimpleActorStream.
|
void |
queryResult(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable payload)
Dispatches a queryResult to a matching method on
the SimpleActorStream.
|
java.lang.String |
toString() |
protected BamSkeleton<T> createSkeleton(T actor)
public java.lang.String getAddress()
Broker
can
register it.getAddress
in interface MessageStream
public boolean isClosed()
MessageStream
isClosed
in interface MessageStream
public Broker getBroker()
getBroker
in interface MessageStream
public void message(java.lang.String to, java.lang.String from, java.io.Serializable payload)
@Message
with
a payload class matching the message payload.
If no method is found, the message is ignored.message
in interface MessageStream
to
- the SimpleActorStream's addressfrom
- the sending actor's addresspayload
- the message payloadpublic void messageError(java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
@MessageError
with
a payload class matching the messageError payload.
If no method is found, the messageError is ignored.messageError
in interface MessageStream
to
- the SimpleActorStream's addressfrom
- the sending actor's addresspayload
- the message payloaderror
- the message errorpublic void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
@QueryGet
with
a payload class matching the queryGet payload.
The @QueryGet
method MUST
send either a queryResult or queryError as a response.
If no method is found, queryGet sends a queryError response with
a feature-not-implemented error.query
in interface MessageStream
id
- a correlation id to match the result or errorto
- the SimpleActorStream's addressfrom
- the client actor's addresspayload
- the query payloadpublic void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
@QueryResult
with
a payload class matching the queryResult payload.
If no method is found, queryResult ignores the packet.queryResult
in interface MessageStream
id
- the correlation id from the original queryto
- the SimpleActorStream's addressfrom
- the client actor's addresspayload
- the query payloadpublic void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
@QueryError
with
a payload class matching the queryError payload.
If no method is found, queryError ignores the packet.queryError
in interface MessageStream
id
- the correlation id from the original queryto
- the SimpleActorStream's addressfrom
- the client actor's addresspayload
- the query payloaderror
- the error informationpublic java.lang.String toString()
toString
in class java.lang.Object