org.apache.ignite.streamer

## Interface StreamerContext

All Known Implementing Classes:
  GridStreamerContextDelegate, GridStreamerContextImpl

    public interface StreamerContext

Streamer context. Provides access to streamer local store, configured windows and various methods to run streamer queries.

### Method Summary

Methods
`void` `broadcast(IgniteInClosure<StreamerContext> clo)` Queries all streamer nodes deployed within grid.
`void` `broadcast(IgniteInClosure<StreamerContext> clo, Collection<ClusterNode> nodes)` Queries streamer nodes deployed within grid.
`<K,V> ConcurrentMap<K,V>` `localSpace()` Gets streamer local space.
`String` `nextStageName()` For context passed to `StreamerStage.run(StreamerContext, Collection)` this method will return next stage name in execution pipeline.
`ClusterGroup` `projection()` Gets instance of dynamic grid projection including all nodes on which this streamer is running.
`<R> Collection<R>` `query(IgniteClosure<StreamerContext,R> clo)` Queries all streamer nodes deployed within grid.
`<R> Collection<R>` `query(IgniteClosure<StreamerContext,R> clo, Collection<ClusterNode> nodes)` Queries streamer nodes deployed within grid.
`<R1,R2> R2` `reduce(IgniteClosure<StreamerContext,R1> clo, IgniteReducer<R1,R2> rdc)` Queries all streamer nodes deployed within grid.
`<R1,R2> R2` `reduce(IgniteClosure<StreamerContext,R1> clo, IgniteReducer<R1,R2> rdc, Collection<ClusterNode> nodes)` Queries streamer nodes deployed within grid.
`<E> StreamerWindow<E>` `window()` Gets default event window, i.e. window that is on the first place in streamer configuration.
`<E> StreamerWindow<E>` `window(String winName)` Gets streamer event window by window name, if no window with such name was configured `IllegalArgumentException` will be thrown.

### Method Detail

#### projection

    ClusterGroup projection()

Gets instance of dynamic grid projection including all nodes on which this streamer is running.

Returns:
  Projection with all nodes on which streamer is configured.

#### localSpace

    <K,V> ConcurrentMap<K,V> localSpace()

Gets streamer local space. Note that all updates to this space will be local.

Returns:
  Streamer local space.

#### window

    <E> StreamerWindow<E> window()

Gets default event window, i.e. window that is on the first place in streamer configuration.

Returns:
  Default window.

#### window

    <E> StreamerWindow<E> window(String winName)

Gets streamer event window by window name, if no window with such name was configured `IllegalArgumentException` will be thrown.

Parameters:
  `winName` - Window name.
Returns:
  Window instance.

#### nextStageName

    String nextStageName()

For context passed to `StreamerStage.run(StreamerContext, Collection)` this method will return next stage name in execution pipeline. For context obtained from streamer object, this method will return first stage name.

Returns:
  Next stage name depending on invocation context.

#### query

    <R> Collection<R> query(IgniteClosure<StreamerContext,R> clo)
                        throws IgniteException

Queries all streamer nodes deployed within grid. Given closure will be executed on each node on which streamer is configured. Streamer context local for that node will be passed to closure during execution. All results returned by closure will be added to result collection.

Parameters:
  `clo` - Function to be executed on individual nodes.
Returns:
  Result received from all streamers.
Throws:
  `IgniteException` - If query execution failed.

#### query

    <R> Collection<R> query(IgniteClosure<StreamerContext,R> clo,
                          Collection<ClusterNode> nodes)
                        throws IgniteException

Queries streamer nodes deployed within grid. Given closure will be executed on those of passed nodes on which streamer is configured. Streamer context local for that node will be passed to closure during execution. All results returned by closure will be added to result collection.

Parameters:
  `clo` - Function to be executed on individual nodes.
  `nodes` - Optional list of nodes to execute query on, if empty, then all nodes on which this streamer is running will be queried.
Returns:
  Result received from all streamers.
Throws:
  `IgniteException` - If query execution failed.

#### broadcast

    void broadcast(IgniteInClosure<StreamerContext> clo)
                   throws IgniteException

Queries all streamer nodes deployed within grid. Given closure will be executed on each streamer node in the grid. No result is collected.

Parameters:
  `clo` - Function to be executed on individual nodes.
Throws:
  `IgniteException` - If closure execution failed.

#### broadcast

    void broadcast(IgniteInClosure<StreamerContext> clo,
                 Collection<ClusterNode> nodes)
                   throws IgniteException

Queries streamer nodes deployed within grid. Given closure will be executed on those of passed nodes on which streamer is configured. No result is collected.

Parameters:
  `clo` - Function to be executed on individual nodes.
  `nodes` - Optional list of nodes to execute query on, if empty, then all nodes on which this streamer is running will be queried.
Throws:
  `IgniteException` - If closure execution failed.

#### reduce

    <R1,R2> R2 reduce(IgniteClosure<StreamerContext,R1> clo,
                    IgniteReducer<R1,R2> rdc)
              throws IgniteException

Queries all streamer nodes deployed within grid. Given closure will be executed on each streamer node in the grid. Streamer context local for that node will be passed to closure during execution. Results returned by closure will be passed to given reducer.

Parameters:
  `clo` - Function to be executed on individual nodes.
  `rdc` - Reducer to reduce results received from remote nodes.
Returns:
  Reducer result.
Throws:
  `IgniteException` - If query execution failed.

#### reduce

    <R1,R2> R2 reduce(IgniteClosure<StreamerContext,R1> clo,
                    IgniteReducer<R1,R2> rdc,
                    Collection<ClusterNode> nodes)
              throws IgniteException

Queries streamer nodes deployed within grid. Given closure will be executed on those of passed nodes on which streamer is configured. Streamer context local for that node will be passed to closure during execution. Results returned by closure will be passed to given reducer.

Parameters:
  `clo` - Function to be executed on individual nodes.
  `rdc` - Reducer to reduce results received from remote nodes.
  `nodes` - Optional list of nodes to execute query on, if empty, then all nodes on which this streamer is running will be queried.
Returns:
  Reducer result.
Throws:
  `IgniteException` - If query execution failed.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015