org.apache.ignite.stream

## Class StreamVisitor<K,V>

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

- All Implemented Interfaces:
    Serializable, IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>>, StreamReceiver<K,V>

      public abstract class StreamVisitor<K,V>
      extends Object
      implements StreamReceiver<K,V>, IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>>

  Convenience adapter to visit every key-value tuple in the stream. Note, that the visitor does not update the cache. If the tuple needs to be stored in the cache, then `cache.put(...)` should be called explicitly.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StreamVisitor()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <K,V> StreamVisitor<K,V>` | `from(IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>> c)` Creates a new visitor based on instance of `IgniteBiInClosure`.
    `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 org.apache.ignite.lang.IgniteBiInClosure

      `apply`

- - ### Constructor Detail

    - #### StreamVisitor

          public StreamVisitor()

  - ### 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> StreamVisitor<K,V> from(IgniteBiInClosure<IgniteCache<K,V>,Map.Entry<K,V>> c)

      Creates a new visitor based on instance of `IgniteBiInClosure`.
      Type Parameters:
        `K` - Ignite cache key type.
        `V` - Ignite cache value type.
      Parameters:
        `c` - Closure.
      Returns:
        Stream visitor.

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