Package org.apache.avro.ipc
Class Requestor
java.lang.Object
org.apache.avro.ipc.Requestor
- Direct Known Subclasses:
GenericRequestor
,SpecificRequestor
Base class for the client side of a protocol interaction.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Handles callbacks from transceiver invocations. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRPCPlugin
(RPCPlugin plugin) Adds a new plugin to manipulate RPC metadata.getLocal()
Return the remote protocol.Deprecated.abstract Exception
Reads an error message.readResponse
(Schema schema, Decoder in) Deprecated.abstract Object
readResponse
(Schema writer, Schema reader, Decoder in) Reads a response message.Writes a request message and reads a response or error message.<T> void
Writes a request message and returns the result through a Callback.abstract void
writeRequest
(Schema schema, Object request, Encoder out) Writes a request message.
-
Field Details
-
rpcMetaPlugins
-
-
Constructor Details
-
Requestor
- Throws:
IOException
-
-
Method Details
-
getLocal
-
getTransceiver
-
addRPCPlugin
Adds a new plugin to manipulate RPC metadata. Plugins are executed in the order that they are added.- Parameters:
plugin
- a plugin that will manipulate RPC metadata
-
request
Writes a request message and reads a response or error message.- Throws:
Exception
-
request
public <T> void request(String messageName, Object request, Callback<T> callback) throws AvroRemoteException, IOException Writes a request message and returns the result through a Callback. Clients can also use a Future interface by creating a new CallFuture, passing it in as the Callback parameter, and then waiting on that Future. - Type Parameters:
T
- the return type of the message.- Parameters:
messageName
- the name of the message to invoke.request
- the request data to send.callback
- the callback which will be invoked when the response is returned or an error occurs.- Throws:
AvroRemoteException
- if an exception is thrown to client by server.IOException
- if an I/O error occurs while sending the message.AvroRuntimeException
- for another undeclared error while sending the message.
-
getRemote
Return the remote protocol. Force a handshake if required.- Throws:
IOException
-
writeRequest
Writes a request message.- Throws:
IOException
-
readResponse
Deprecated.- Throws:
IOException
-
readResponse
Reads a response message.- Throws:
IOException
-
readError
Deprecated.- Throws:
IOException
-
readError
Reads an error message.- Throws:
IOException
-