org.apache.ignite.stream

## Class StreamAdapter<T,K,V>

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

- Direct Known Subclasses:
    SocketStreamer

      public abstract class StreamAdapter<T,K,V>
      extends Object

  Convenience adapter for streamers. Adapters are optional components for streaming from different data sources. The purpose of adapters is to convert different message formats into Ignite stream key-value tuples and feed the tuples into the provided `IgniteDataStreamer`.

  Two types of tuple extractors are supported:

  1. A single tuple extractor, which extracts either no or 1 tuple out of a message. See see `setTupleExtractor(StreamTupleExtractor)`.
  2. A multiple tuple extractor, which is capable of extracting multiple tuples out of a single message, in the form of a `Map`. See `setMultipleTupleExtractor(StreamMultipleTupleExtractor)`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Ignite` | `ignite` Ignite.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `StreamAdapter()` Empty constructor.
    `protected` | `StreamAdapter(IgniteDataStreamer<K,V> stmr, StreamMultipleTupleExtractor<T,K,V> extractor)` Stream adapter.
    `protected` | `StreamAdapter(IgniteDataStreamer<K,V> stmr, StreamSingleTupleExtractor<T,K,V> extractor)` Stream adapter.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addMessage(T msg)` Converts given message to 1 or many tuples (depending on the type of extractor) and adds it/them to the underlying streamer.
    `Ignite` | `getIgnite()`
    `StreamMultipleTupleExtractor<T,K,V>` | `getMultipleTupleExtractor()`
    `StreamSingleTupleExtractor<T,K,V>` | `getSingleTupleExtractor()`
    `IgniteDataStreamer<K,V>` | `getStreamer()`
    `StreamTupleExtractor<T,K,V>` | `getTupleExtractor()` Deprecated.
    `void` | `setIgnite(Ignite ignite)`
    `void` | `setMultipleTupleExtractor(StreamMultipleTupleExtractor<T,K,V> multipleTupleExtractor)`
    `void` | `setSingleTupleExtractor(StreamSingleTupleExtractor<T,K,V> singleTupleExtractor)`
    `void` | `setStreamer(IgniteDataStreamer<K,V> stmr)`
    `void` | `setTupleExtractor(StreamTupleExtractor<T,K,V> extractor)` Deprecated.

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

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

- - ### Field Detail

    - #### ignite

          protected Ignite ignite

      Ignite.

  - ### Constructor Detail

    - #### StreamAdapter

          protected StreamAdapter()

      Empty constructor.

    - #### StreamAdapter

          protected StreamAdapter(IgniteDataStreamer<K,V> stmr,
                                  StreamSingleTupleExtractor<T,K,V> extractor)

      Stream adapter.
      Parameters:
        `stmr` - Streamer.
        `extractor` - Tuple extractor (1:1).

    - #### StreamAdapter

          protected StreamAdapter(IgniteDataStreamer<K,V> stmr,
                                  StreamMultipleTupleExtractor<T,K,V> extractor)

      Stream adapter.
      Parameters:
        `stmr` - Streamer.
        `extractor` - Tuple extractor (1:n).

  - ### Method Detail

    - #### getStreamer

          public IgniteDataStreamer<K,V> getStreamer()

      Returns:
        Provided data streamer.

    - #### setStreamer

          public void setStreamer(IgniteDataStreamer<K,V> stmr)

      Parameters:
        `stmr` - Ignite data streamer.

    - #### getTupleExtractor

          @Deprecated
          public StreamTupleExtractor<T,K,V> getTupleExtractor()

      Deprecated.
      Returns:
        Provided tuple extractor.
      See Also:
        `getSingleTupleExtractor()`

    - #### setTupleExtractor

          @Deprecated
          public void setTupleExtractor(StreamTupleExtractor<T,K,V> extractor)

      Deprecated.
      Parameters:
        `extractor` - Extractor for a single key-value tuple from the message.
      See Also:
        `setSingleTupleExtractor(StreamSingleTupleExtractor)`

    - #### getSingleTupleExtractor

          public StreamSingleTupleExtractor<T,K,V> getSingleTupleExtractor()

      Returns:
        Provided single tuple extractor.

    - #### setSingleTupleExtractor

          public void setSingleTupleExtractor(StreamSingleTupleExtractor<T,K,V> singleTupleExtractor)

      Parameters:
        `singleTupleExtractor` - Extractor for key-value tuples from messages.

    - #### getMultipleTupleExtractor

          public StreamMultipleTupleExtractor<T,K,V> getMultipleTupleExtractor()

      Returns:
        Provided tuple extractor (for 1:n cardinality).

    - #### setMultipleTupleExtractor

          public void setMultipleTupleExtractor(StreamMultipleTupleExtractor<T,K,V> multipleTupleExtractor)

      Parameters:
        `multipleTupleExtractor` - Extractor for 1:n tuple extraction.

    - #### getIgnite

          public Ignite getIgnite()

      Returns:
        Provided `Ignite` instance.

    - #### setIgnite

          public void setIgnite(Ignite ignite)

      Parameters:
        `ignite` - `Ignite` instance.

    - #### addMessage

          protected void addMessage(T msg)

      Converts given message to 1 or many tuples (depending on the type of extractor) and adds it/them to the underlying streamer.
      Parameters:
        `msg` - Message to convert.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022