public class HmtpClient extends java.lang.Object implements RemoteActorSender
Constructor and Description |
---|
HmtpClient(java.lang.String url) |
HmtpClient(java.lang.String url,
ActorHolder actor) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the sender.
|
void |
connect() |
void |
connect(java.lang.String user,
java.io.Serializable credentials) |
void |
connect(java.lang.String user,
java.lang.String password) |
protected void |
connectImpl() |
<T> T |
createProxy(java.lang.Class<T> api,
java.lang.String to) |
protected void |
finalize() |
void |
flush() |
java.lang.String |
getAddress()
Returns the address
|
Broker |
getBroker()
The underlying broker.
|
java.lang.String |
getBrokerAddress()
Returns the broker address
|
QueryManager |
getQueryManager() |
java.lang.String |
getUrl() |
boolean |
isClosed()
Returns true if the sender is closed
|
protected void |
loginImpl(java.lang.String uid,
java.io.Serializable credentials)
Login to the server
|
void |
message(BamActorRef to,
java.io.Serializable payload)
Sends a unidirectional message to an
ActorHolder ,
addressed by the Actor's address. |
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.
|
void |
query(BamActorRef 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.
|
void |
query(BamActorRef to,
java.io.Serializable payload,
QueryCallback callback,
long timeout)
Sends a query information call (get) to an actor,
providing a callback to receive the result or error.
|
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.
|
void |
query(java.lang.String to,
java.io.Serializable payload,
QueryCallback callback,
long timeout)
Sends a query information call (get) to an actor,
providing a callback to receive the result or error.
|
void |
setEncryptPassword(boolean isEncrypt) |
void |
setVirtualHost(java.lang.String host) |
java.lang.String |
toString() |
public HmtpClient(java.lang.String url, ActorHolder actor)
public HmtpClient(java.lang.String url)
public void setVirtualHost(java.lang.String host)
public void setEncryptPassword(boolean isEncrypt)
public Broker getBroker()
ActorSender
getBroker
in interface ActorSender
getBroker
in interface QuerySender
public void connect()
public void connect(java.lang.String user, java.lang.String password)
public void connect(java.lang.String user, java.io.Serializable credentials)
public java.lang.String getUrl()
getUrl
in interface RemoteActorSender
protected void connectImpl()
protected void loginImpl(java.lang.String uid, java.io.Serializable credentials)
public java.lang.String getAddress()
getAddress
in interface QuerySender
public java.lang.String getBrokerAddress()
public void flush() throws java.io.IOException
java.io.IOException
public void close()
ActorSender
close
in interface ActorSender
public boolean isClosed()
ActorSender
isClosed
in interface ActorSender
public long nextQueryId()
ActorSender
nextQueryId
in interface ActorSender
public void message(java.lang.String to, java.io.Serializable payload)
ActorSender
ActorHolder
,
addressed by the Actor's address.message
in interface ActorSender
message
in interface QuerySender
to
- the target actor's addresspayload
- the message payloadpublic void message(BamActorRef to, java.io.Serializable payload)
ActorSender
ActorHolder
,
addressed by the Actor's address.message
in interface ActorSender
to
- the target actor's addresspayload
- the message payloadpublic java.io.Serializable query(java.lang.String to, java.io.Serializable payload)
ActorSender
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.query
in interface ActorSender
query
in interface QuerySender
to
- the target actor's addresspayload
- the query payloadpublic java.io.Serializable query(java.lang.String to, java.io.Serializable payload, long timeout)
ActorSender
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.query
in interface ActorSender
query
in interface QuerySender
to
- the target actor's addresspayload
- the query payloadtimeout
- time spent waiting for the query to returnpublic void query(java.lang.String to, java.io.Serializable payload, QueryCallback callback)
ActorSender
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.query
in interface ActorSender
query
in interface QuerySender
to
- the target actor's addresspayload
- the query payloadcallback
- the application's callback for the resultpublic void query(java.lang.String to, java.io.Serializable payload, QueryCallback callback, long timeout)
ActorSender
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.query
in interface ActorSender
query
in interface QuerySender
to
- the target actor's addresspayload
- the query payloadcallback
- the application's callback for the resultpublic void query(BamActorRef to, java.io.Serializable payload, QueryCallback callback)
ActorSender
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.query
in interface ActorSender
to
- the target actor's addresspayload
- the query payloadcallback
- the application's callback for the resultpublic void query(BamActorRef to, java.io.Serializable payload, QueryCallback callback, long timeout)
ActorSender
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.query
in interface ActorSender
to
- the target actor's addresspayload
- the query payloadcallback
- the application's callback for the resultpublic QueryManager getQueryManager()
getQueryManager
in interface QuerySender
public <T> T createProxy(java.lang.Class<T> api, java.lang.String to)
public java.lang.String toString()
toString
in class java.lang.Object
protected void finalize()
finalize
in class java.lang.Object