org.apache.avro.ipc

## Class Requestor

- java.lang.Object
- - org.apache.avro.ipc.Requestor

Direct Known Subclasses:
  GenericRequestor, SpecificRequestor

    public abstract class Requestor
    extends Object

Base class for the client side of a protocol interaction.

### Nested Class Summary

Nested Classes
`protected class` `Requestor.TransceiverCallback<T>` Handles callbacks from transceiver invocations.

### Field Summary

Fields
`protected List<RPCPlugin>` `rpcMetaPlugins`

### Constructor Summary

Constructors
`protected` `Requestor(org.apache.avro.Protocol local, Transceiver transceiver)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
`void` `addRPCPlugin(RPCPlugin plugin)` Adds a new plugin to manipulate RPC metadata.
`org.apache.avro.Protocol` `getLocal()`
`org.apache.avro.Protocol` `getRemote()` Return the remote protocol.
`Transceiver` `getTransceiver()`
`Object` `readError(org.apache.avro.Schema schema, org.apache.avro.io.Decoder in)` Deprecated.
`abstract Exception` `readError(org.apache.avro.Schema writer, org.apache.avro.Schema reader, org.apache.avro.io.Decoder in)` Reads an error message.
`Object` `readResponse(org.apache.avro.Schema schema, org.apache.avro.io.Decoder in)` Deprecated.
`abstract Object` `readResponse(org.apache.avro.Schema writer, org.apache.avro.Schema reader, org.apache.avro.io.Decoder in)` Reads a response message.
`Object` `request(String messageName, Object request)` Writes a request message and reads a response or error message.
`<T> void` `request(String messageName, Object request, Callback<T> callback)` Writes a request message and returns the result through a Callback.
`abstract void` `writeRequest(org.apache.avro.Schema schema, Object request, org.apache.avro.io.Encoder out)` Writes a request message.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### rpcMetaPlugins

    protected final List<RPCPlugin> rpcMetaPlugins

### Constructor Detail

#### Requestor

    protected Requestor(org.apache.avro.Protocol local,
                        Transceiver transceiver)
                 throws IOException

Throws:
  `IOException`

### Method Detail

#### getLocal

    public org.apache.avro.Protocol getLocal()

#### getTransceiver

    public Transceiver getTransceiver()

#### addRPCPlugin

    public void addRPCPlugin(RPCPlugin plugin)

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

    public Object request(String messageName,
                          Object request)
                   throws Exception

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 org.apache.avro.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<T>, 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:
  `org.apache.avro.AvroRemoteException` - if an exception is thrown to client by server.
  `IOException` - if an I/O error occurs while sending the message.
  `org.apache.avro.AvroRuntimeException` - for another undeclared error while sending the message.

#### getRemote

    public org.apache.avro.Protocol getRemote()
                                       throws IOException

Return the remote protocol. Force a handshake if required.

Throws:
  `IOException`

#### writeRequest

    public abstract void writeRequest(org.apache.avro.Schema schema,
                                      Object request,
                                      org.apache.avro.io.Encoder out)
                               throws IOException

Writes a request message.

Throws:
  `IOException`

#### readResponse

    @Deprecated
    public Object readResponse(org.apache.avro.Schema schema,
                                           org.apache.avro.io.Decoder in)
                                    throws IOException

Deprecated.

Throws:
  `IOException`

#### readResponse

    public abstract Object readResponse(org.apache.avro.Schema writer,
                                        org.apache.avro.Schema reader,
                                        org.apache.avro.io.Decoder in)
                                 throws IOException

Reads a response message.

Throws:
  `IOException`

#### readError

    @Deprecated
    public Object readError(org.apache.avro.Schema schema,
                                        org.apache.avro.io.Decoder in)
                                 throws IOException

Deprecated.

Throws:
  `IOException`

#### readError

    public abstract Exception readError(org.apache.avro.Schema writer,
                                        org.apache.avro.Schema reader,
                                        org.apache.avro.io.Decoder in)
                                 throws IOException

Reads an error message.

Throws:
  `IOException`