org.apache.ignite.stream.socket

## Class SocketStreamer<T,K,V>

- java.lang.Object
- - org.apache.ignite.stream.StreamAdapter<T,K,V>
  - - org.apache.ignite.stream.socket.SocketStreamer<T,K,V>

-     public class SocketStreamer<T,K,V>
      extends StreamAdapter<T,K,V>

  Server that receives data from TCP socket, converts it to key-value pairs using `StreamTupleExtractor` and streams into `IgniteDataStreamer` instance.

  By default server uses size-based message processing. That is every message sent over the socket is prepended with 4-byte integer header containing message size. If message delimiter is defined (see `setDelimiter(byte[])`) then delimiter-based message processing will be used. That is every message sent over the socket is appended with provided delimiter.

  Received messages through socket converts to Java object using standard serialization. Conversion functionality can be customized via user defined `SocketMessageConverter` (e.g. in order to convert messages from non Java clients).

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.stream.StreamAdapter

      `ignite`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SocketStreamer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setAddr(InetAddress addr)` Sets server address.
    `void` | `setConverter(SocketMessageConverter<T> converter)` Sets message converter.
    `void` | `setDelimiter(byte[] delim)` Sets message delimiter.
    `void` | `setDirectMode(boolean directMode)` Sets direct mode flag.
    `void` | `setPort(int port)` Sets port number.
    `void` | `setThreads(int threads)` Sets threadds amount.
    `void` | `start()` Starts streamer.
    `void` | `stop()` Stops streamer.

    - ### Methods inherited from class org.apache.ignite.stream.StreamAdapter

      `addMessage, getIgnite, getMultipleTupleExtractor, getSingleTupleExtractor, getStreamer, getTupleExtractor, setIgnite, setMultipleTupleExtractor, setSingleTupleExtractor, setStreamer, setTupleExtractor`

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

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

- - ### Constructor Detail

    - #### SocketStreamer

          public SocketStreamer()

  - ### Method Detail

    - #### setAddr

          public void setAddr(InetAddress addr)

      Sets server address.
      Parameters:
        `addr` - Address.

    - #### setPort

          public void setPort(int port)

      Sets port number.
      Parameters:
        `port` - Port.

    - #### setThreads

          public void setThreads(int threads)

      Sets threadds amount.
      Parameters:
        `threads` - Threads.

    - #### setDirectMode

          public void setDirectMode(boolean directMode)

      Sets direct mode flag.
      Parameters:
        `directMode` - Direct mode.

    - #### setDelimiter

          public void setDelimiter(byte[] delim)

      Sets message delimiter.
      Parameters:
        `delim` - Delimiter.

    - #### setConverter

          public void setConverter(SocketMessageConverter<T> converter)

      Sets message converter.
      Parameters:
        `converter` - Converter.

    - #### start

          public void start()

      Starts streamer.
      Throws:
        `IgniteException` - If failed.

    - #### stop

          public void stop()

      Stops streamer.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023