org.apache.ignite.internal.managers.communication

## Interface TransmissionHandler

    public interface TransmissionHandler

Class represents a handler for the set of files considered to be transferred from the remote node. This handler must be registered to and appropriate topic in `GridIoManager` prior to opening a new transmission connection to this topic.

NOTE: Only one such handler per registered topic is allowed for the communication manager. Only one thread is allowed for data processing within a single topic.

### TransmissionPolicy

Files from the remote node can be handled of two different ways within a single established connection. It is up to the sender to decide how the particular file must be processed by the remote node. The `TransmissionPolicy` is used for such purpose. If `TransmissionPolicy.FILE` type is received by remote node the #fileHandler() will be picked up to process this file, the otherwise for the `TransmissionPolicy.CHUNK` the #chunkHandler() will be picked up.

### Method Summary

All Methods Instance Methods Abstract Methods
`Consumer<ByteBuffer>` `chunkHandler(UUID nodeId, TransmissionMeta initMeta)` Chunk handler represents by itself the way of input data stream processing.
`Consumer<File>` `fileHandler(UUID nodeId, TransmissionMeta initMeta)` File handler represents by itself the way of input data stream processing.
`String` `filePath(UUID nodeId, TransmissionMeta fileMeta)` Absolute path of a file to receive remote transmission data into.
`void` `onException(UUID nodeId, Throwable err)`

### Method Detail

#### onException

    void onException(UUID nodeId,
                     Throwable err)

Parameters:
  `nodeId` - Remote node id on which the error occurred.
  `err` - The err of fail handling process.

#### filePath

    String filePath(UUID nodeId,
                    TransmissionMeta fileMeta)

Absolute path of a file to receive remote transmission data into. The `TransmissionCancelledException` can be thrown if it is necessary to gracefully interrupt current transmission session on the node-sender.

Parameters:
  `nodeId` - Remote node id from which request has been received.
  `fileMeta` - File meta info.
Returns:
  Absolute pathname denoting a file.

#### chunkHandler

    Consumer<ByteBuffer> chunkHandler(UUID nodeId,
                                      TransmissionMeta initMeta)

Chunk handler represents by itself the way of input data stream processing. It accepts within each chunk a `ByteBuffer` with data from input for further processing. Activated when the `TransmissionPolicy.CHUNK` policy sent.

The `TransmissionCancelledException` can be thrown to gracefully interrupt the local transmission and the node-senders transmission session.

Parameters:
  `nodeId` - Remote node id from which request has been received.
  `initMeta` - Initial handler meta info.
Returns:
  Instance of chunk handler to process incoming data by chunks.

#### fileHandler

    Consumer<File> fileHandler(UUID nodeId,
                               TransmissionMeta initMeta)

File handler represents by itself the way of input data stream processing. All the data will be processed under the hood using zero-copy transferring algorithm and only start file processing and the end of processing will be provided. Activated when the `TransmissionPolicy.FILE` policy sent.

The `TransmissionCancelledException` can be thrown to gracefully interrupt the local transmission and the node-senders transmission session.

Parameters:
  `nodeId` - Remote node id from which request has been received.
  `initMeta` - Initial handler meta info.
Returns:
  Intance of read handler to process incoming data like the `FileChannel` manner.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.0
Release Date | : February 27 2020