public class MessageTransport extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
MessageTransport.ErrorCallback
A callback that is invoked when errors occur at the transport level.
|
class |
MessageTransport.RequestException
An exception that is generated by the transport when it receives a failure
message from the server in response to executing a client request.
|
Constructor and Description |
---|
MessageTransport(InputStream inputStream,
OutputStream outputStream,
RequestProcessor requestProcessor,
MessageTransport.ErrorCallback errorCallback)
Create a new instance using the given streams and request processor.
|
Modifier and Type | Method and Description |
---|---|
Future<RemoteMessageProto.Message.Response> |
executeRequestAsync(RemoteMessageProto.Message.Request requestMessage)
Asynchronously executes the request on a remote server.
|
void |
executeRequestAsync(RemoteMessageProto.Message.Request requestMessage,
Callback<RemoteMessageProto.Message.Response> callback)
Asynchronously executes the request on a remote server.
|
void |
start()
Starts up the message transport.
|
public MessageTransport(InputStream inputStream, OutputStream outputStream, RequestProcessor requestProcessor, MessageTransport.ErrorCallback errorCallback)
inputStream
- an input stream for reading messagesoutputStream
- an output stream for writing messagesrequestProcessor
- a callback interface for handling remote client
requeststerminationCallback
- a callback that is invoked when the transport
terminatespublic Future<RemoteMessageProto.Message.Response> executeRequestAsync(RemoteMessageProto.Message.Request requestMessage)
requestMessage
- The request to executeFuture
that can be used to access the server's responsepublic void executeRequestAsync(RemoteMessageProto.Message.Request requestMessage, Callback<RemoteMessageProto.Message.Response> callback)
requestMessage
- The request to executecallback
- The callback to invoke when the response is receivedpublic void start()
Copyright © 2018. All rights reserved.