public class HempBroker extends AbstractManagedBroker
Modifier and Type | Class and Description |
---|---|
class |
HempBroker.ActorClose |
class |
HempBroker.ActorStartup |
Constructor and Description |
---|
HempBroker(HempBrokerManager manager) |
HempBroker(HempBrokerManager manager,
java.lang.String domain) |
Modifier and Type | Method and Description |
---|---|
void |
addAlias(java.lang.String domain)
Adds a domain alias
|
void |
addMailbox(java.lang.String address,
Mailbox mailbox)
Registers a actor
|
void |
addStartupActor(Bean bean,
java.lang.String name,
int threadMax) |
void |
afterStart() |
void |
close()
Close the Broker
|
protected java.lang.String |
generateAddress(java.lang.String uid,
java.lang.String resource) |
java.lang.String |
getAddress()
getAddress() returns null for the broker
|
BamManager |
getBamManager() |
static HempBroker |
getCurrent() |
protected java.lang.String |
getDomain()
Returns the domain
|
Mailbox |
getMailbox(java.lang.String address)
Returns the mailbox for the given address
|
protected java.lang.String |
getManagerAddress()
Returns the manager's own id.
|
boolean |
isClosed()
Returns true if the broker is closed
|
void |
message(java.lang.String to,
java.lang.String from,
java.io.Serializable payload)
Sends a message to the desination mailbox.
|
void |
messageError(java.lang.String to,
java.lang.String from,
java.io.Serializable payload,
BamError error)
Sends a messageError to the desination mailbox.
|
void |
query(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable payload)
Sends a query to the destination mailbox.
|
void |
queryError(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable payload,
BamError error)
Sends a query to the destination mailbox.
|
void |
queryResult(long id,
java.lang.String to,
java.lang.String from,
java.io.Serializable payload)
Sends a query to the destination mailbox.
|
void |
removeMailbox(Mailbox mailbox)
Removes a actor
|
void |
setDomainManager(DomainManager domainManager) |
protected boolean |
startActorFromManager(java.lang.String address) |
java.lang.String |
toString() |
createAgent, createAgent, createClient, createMailbox, createMailbox
getBroker, getBrokerMailbox, getQueueFullHandler, setQueueFullHandler
getQueryErrorStream
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBrokerMailbox, getQueueFullHandler
getBroker
public HempBroker(HempBrokerManager manager)
public HempBroker(HempBrokerManager manager, java.lang.String domain)
public static HempBroker getCurrent()
public BamManager getBamManager()
public void setDomainManager(DomainManager domainManager)
public boolean isClosed()
isClosed
in interface MessageStream
isClosed
in class AbstractManagedBroker
public void addAlias(java.lang.String domain)
public void afterStart()
protected java.lang.String generateAddress(java.lang.String uid, java.lang.String resource)
public void addMailbox(java.lang.String address, Mailbox mailbox)
addMailbox
in interface Broker
addMailbox
in interface ManagedBroker
addMailbox
in class AbstractManagedBroker
public void removeMailbox(Mailbox mailbox)
removeMailbox
in interface Broker
removeMailbox
in interface ManagedBroker
removeMailbox
in class AbstractManagedBroker
protected java.lang.String getManagerAddress()
protected java.lang.String getDomain()
public java.lang.String getAddress()
getAddress
in interface MessageStream
getAddress
in class AbstractBroker
public void message(java.lang.String to, java.lang.String from, java.io.Serializable payload)
message
in interface MessageStream
message
in class AbstractBrokerStream
to
- the target actor's addressfrom
- the source actor's addresspayload
- the message payloadpublic void messageError(java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
messageError
in interface MessageStream
messageError
in class AbstractBrokerStream
to
- the target actor's addressfrom
- the source actor's addresspayload
- the original message payloaderror
- the message errorpublic void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload)
query
in interface MessageStream
query
in class AbstractBrokerStream
id
- the query identifier used to match requests with responsesto
- the service actor'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
in interface MessageStream
queryResult
in class AbstractBrokerStream
id
- the query identifier used to match requests with responsesto
- the client actor's addressfrom
- the service actor's addresspayload
- the result payloadpublic void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable payload, BamError error)
queryError
in interface MessageStream
queryError
in class AbstractBrokerStream
id
- the query identifier used to match requests with responsesto
- the client actor's addressfrom
- the service actor's addresspayload
- the result payloaderror
- additional error informationpublic Mailbox getMailbox(java.lang.String address)
getMailbox
in interface Broker
getMailbox
in class AbstractBroker
address
- the address of the mailboxprotected boolean startActorFromManager(java.lang.String address)
public void addStartupActor(Bean bean, java.lang.String name, int threadMax)
public void close()
Broker
close
in interface Broker
close
in class AbstractBroker
public java.lang.String toString()
toString
in class AbstractBrokerStream