org.apache.avro.ipc

## Class Responder

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

Direct Known Subclasses:
  GenericResponder

    public abstract class Responder
    extends Object

Base class for the server side of a protocol interaction.

### Field Summary

Fields
`protected List<RPCPlugin>` `rpcMetaPlugins`

### Constructor Summary

Constructors
`protected` `Responder(org.apache.avro.Protocol local)`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`void` `addRPCPlugin(RPCPlugin plugin)` Adds a new plugin to manipulate per-call metadata.
`org.apache.avro.Protocol` `getLocal()` Return the local protocol.
`static org.apache.avro.Protocol` `getRemote()` Return the remote protocol.
`abstract Object` `readRequest(org.apache.avro.Schema actual, org.apache.avro.Schema expected, org.apache.avro.io.Decoder in)` Reads a request message.
`List<ByteBuffer>` `respond(List<ByteBuffer> buffers)` Called by a server to deserialize a request, compute and serialize a response or error.
`List<ByteBuffer>` `respond(List<ByteBuffer> buffers, Transceiver connection)` Called by a server to deserialize a request, compute and serialize a response or error.
`abstract Object` `respond(org.apache.avro.Protocol.Message message, Object request)` Computes the response for a message.
`abstract void` `writeError(org.apache.avro.Schema schema, Object error, org.apache.avro.io.Encoder out)` Writes an error message.
`abstract void` `writeResponse(org.apache.avro.Schema schema, Object response, org.apache.avro.io.Encoder out)` Writes a response 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

#### Responder

    protected Responder(org.apache.avro.Protocol local)

### Method Detail

#### getRemote

    public static org.apache.avro.Protocol getRemote()

Return the remote protocol. Accesses a `ThreadLocal` that's set around calls to `respond(Protocol.Message, Object)`.

#### getLocal

    public org.apache.avro.Protocol getLocal()

Return the local protocol.

#### addRPCPlugin

    public void addRPCPlugin(RPCPlugin plugin)

Adds a new plugin to manipulate per-call metadata. Plugins are executed in the order that they are added.

Parameters:
  `plugin` - a plugin that will manipulate RPC metadata

#### respond

    public List<ByteBuffer> respond(List<ByteBuffer> buffers)
                             throws IOException

Called by a server to deserialize a request, compute and serialize a response or error.

Throws:
  `IOException`

#### respond

    public List<ByteBuffer> respond(List<ByteBuffer> buffers,
                                    Transceiver connection)
                             throws IOException

Called by a server to deserialize a request, compute and serialize a response or error. Transceiver is used by connection-based servers to track handshake status of connection.

Throws:
  `IOException`

#### respond

    public abstract Object respond(org.apache.avro.Protocol.Message message,
                                   Object request)
                            throws Exception

Computes the response for a message.

Throws:
  `Exception`

#### readRequest

    public abstract Object readRequest(org.apache.avro.Schema actual,
                                       org.apache.avro.Schema expected,
                                       org.apache.avro.io.Decoder in)
                                throws IOException

Reads a request message.

Throws:
  `IOException`

#### writeResponse

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

Writes a response message.

Throws:
  `IOException`

#### writeError

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

Writes an error message.

Throws:
  `IOException`