Package org.apache.ignite.stream

## Class StreamTransformer<K,​V>

- java.lang.Object
- - org.apache.ignite.stream.StreamTransformer<K,​V>

- All Implemented Interfaces:
    `Serializable`, `javax.cache.processor.EntryProcessor<K,​V,​Object>`, `StreamReceiver<K,​V>`

      public abstract class StreamTransformer<K,​V>
      extends Object
      implements StreamReceiver<K,​V>, javax.cache.processor.EntryProcessor<K,​V,​Object>

  Convenience adapter to transform update existing values in streaming cache based on the previously cached value.

  This transformer implement `EntryProcessor` and internally will call `IgniteCache.invoke(Object, EntryProcessor, Object...)` method. Note that the value received from the data streamer will be passed to the entry processor as an argument.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StreamTransformer()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static <K,​V> StreamTransformer<K,​V>` | `from​(CacheEntryProcessor<K,​V,​Object> ep)` | Creates a new transformer based on instance of `CacheEntryProcessor`.
    `void` | `receive​(IgniteCache<K,​V> cache, Collection<Map.Entry<K,​V>> entries)` | Updates cache with batch of entries.

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

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

    - ### Methods inherited from interface javax.cache.processor.EntryProcessor

      `process`

- - ### Constructor Detail

    - #### StreamTransformer

          public StreamTransformer()

  - ### Method Detail

    - #### receive

          public void receive​(IgniteCache<K,​V> cache,
                              Collection<Map.Entry<K,​V>> entries)
                       throws IgniteException

      Updates cache with batch of entries.
      Specified by:
        `receive` in interface `StreamReceiver<K,​V>`
      Parameters:
        `cache` - Cache.
        `entries` - Collection of entries.
      Throws:
        `IgniteException` - If failed.

    - #### from

          public static <K,​V> StreamTransformer<K,​V> from​(CacheEntryProcessor<K,​V,​Object> ep)

      Creates a new transformer based on instance of `CacheEntryProcessor`.
      Type Parameters:
        `K` - Cache key type.
        `V` - Cache value type.
      Parameters:
        `ep` - Entry processor.
      Returns:
        Stream transformer.