public interface RemoteCommunicator
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connects this communicator object with the remote endpoint.
|
void |
disconnect()
Disconnects this communicator object from the remote endpoint.
|
FailureCallback |
getFailureCallback()
Returns the failure callback currently configured within this object.
|
InitializeCallback |
getInitializeCallback()
Returns the initialize callback currently configured within this object.
|
String |
getRemoteEndpoint()
Returns a string representation of the remote endpoint this communicator is configured to talk to.
|
boolean |
isConnected()
Returns
true if this object has established a live connection with the remote endpoint. |
CommandResponse |
send(Command command)
Sends the given command to the remote endpoint by utilizing a remoting framework supported by the specific
communicator implementation.
|
CommandResponse |
sendWithoutCallbacks(Command command)
This is the same as
send(Command) except, on error, this method will not attempt
to call the failure callback, if one was set. |
CommandResponse |
sendWithoutInitializeCallback(Command command)
This is the same as
send(Command) except this method will not attempt
to call the initialize callback,
thus allowing this method to be called from the initialize callback itself. |
void |
setFailureCallback(FailureCallback callback)
Sets the given failure callback as the one that will be notified when this object sees a comm failure.
|
void |
setInitializeCallback(InitializeCallback callback)
Sets the given initialize callback as the one that will be notified when this object attempts
to send its very first message after a
connect(). |
void |
setRemoteEndpoint(String endpoint)
Sets the remote endpoint that this communicator object will send commands to.
|
void connect()
throws Exception
Exception - if failed to connect to the remote endpoint for any reasondisconnect()void disconnect()
Note that the user may later on change its mind and reconnect simply by calling connect().
boolean isConnected()
true if this object has established a live connection with the remote endpoint.true if connected to a remote endpoint; false otheriseCommandResponse send(Command command) throws Throwable
failure callback
is defined, this method will notify that callback of the problem and ask it if it should retry.command - encapsulates the command that is to be executed (must not be null)Throwable - on any error (either during the sending or execution of the command)CommandResponse sendWithoutCallbacks(Command command) throws Throwable
send(Command) except, on error, this method will not attempt
to call the failure callback, if one was set. This is useful when the caller wants to
explicitly handle any failure that might occur without any interference with a failure callback.
This method will also not attempt to call the initialize callback,
thus allowing this method to be called from the initialize callback itself.command - encapsulates the command that is to be executed (must not be null)Throwable - on any error (either during the sending or execution of the command)CommandResponse sendWithoutInitializeCallback(Command command) throws Throwable
send(Command) except this method will not attempt
to call the initialize callback,
thus allowing this method to be called from the initialize callback itself.command - encapsulates the command that is to be executed (must not be null)Throwable - on any error (either during the sending or execution of the command)FailureCallback getFailureCallback()
null)void setFailureCallback(FailureCallback callback)
null if you don't need this object to notify anything when a failure is detected.
The callback can be used to reconfigure this communicator and retry the failed message (useful to implement
failover algorithms).callback - the object that listens to failures and may trigger retries (may be null)InitializeCallback getInitializeCallback()
null)void setInitializeCallback(InitializeCallback callback)
connect(). This allows the callback to perform
additional initialization procedures prior to the first message getting sent to the remote
endpoint. The callback is free to send its own messages via sendWithoutCallbacks(Command)
or sendWithoutInitializeCallback(Command).callback - String getRemoteEndpoint()
Copyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.