org.apache.ignite

## Interface IgniteStreamer

All Known Subinterfaces:
  IgniteStreamerEx

All Known Implementing Classes:
  IgniteStreamerImpl

    public interface IgniteStreamer

Streamer interface. Streamer provides an easy way to process large (possibly infinite) stream of events. Event can be of any object type, different types of events can be submitted to streamer. Each event is processed by one or more `StreamerStage`, a set of stages event passed through is called pipeline.

For each submitted group of events streamer determines one or more execution nodes that will process this group of events. Execution nodes are determined by `StreamerEventRouter`. Execution nodes run stages with received events. After stage execution streamer gets an optional set of events that should be processed further. The process is repeated until stage returns empty map. After stage returned empty map pipeline execution for given group of events is finished.

It is guaranteed that group of events returned by router will be neither split nor concatenated with any other group of events and will be passed to stage as is. Event processing order is not guaranteed, group that was submitted second can be processed earlier then first submitted group.

If `StreamerConfiguration.isAtLeastOnce()` is set to `false`, then event execution is not tracked by streamer and any occurred failure will be reported to failure listener on node on which failure happened. If this configuration property is set to `true`, then streamer will cancel current pipeline execution in case of failure and will try to execute pipeline from the beginning. If failover cannot be succeeded or maximum number of failover attempts is exceeded, then listener will be notified on node which originated pipeline execution.

See Also:
  `StreamerStage`, `StreamerEventRouter`

### Method Summary

Methods
`void` `addEvent(Object evt, Object... evts)` Submits group of events for processing.
`void` `addEvents(Collection<?> evts)` Submits group of events for processing.
`void` `addEventsToStage(String stageName, Collection<?> evts)` Submits events to streamer.
`void` `addEventToStage(String stageName, Object evt, Object... evts)` Submits group of events to streamer.
`void` `addStreamerFailureListener(StreamerFailureListener lsnr)` Adds streamer failure listener.
`StreamerConfiguration` `configuration()` Gets streamer configuration.
`StreamerContext` `context()` Gets streamer context.
`void` `deployClass(Class<?> depCls)` Explicitly sets deployment class.
`StreamerMetrics` `metrics()` Gets current streamer metrics.
`String` `name()` Gets streamer name.
`void` `removeStreamerFailureListener(StreamerFailureListener lsnr)` Removes streamer failure listener.
`void` `reset()` Resets all configured streamer windows by calling `StreamerWindow.reset()` on each and clears local space.
`void` `resetMetrics()` Resets all streamer metrics.

### Method Detail

#### configuration

    StreamerConfiguration configuration()

Gets streamer configuration.

Returns:
  Streamer configuration.

#### name

    String name()

Gets streamer name.

Returns:
  Streamer name, or `null` for default no-name streamer.

#### addEvent

    void addEvent(Object evt,
                Object... evts)
                  throws IgniteException

Submits group of events for processing. This group of events will be processed on default stage, i.e. stage that is the first in the streamer stages list.

Parameters:
  `evt` - Event to add.
  `evts` - Optional events to add.
Throws:
  `IgniteException` - If event submission failed.

#### addEventToStage

    void addEventToStage(String stageName,
                       Object evt,
                       Object... evts)
                         throws IgniteException

Submits group of events to streamer. Events will be processed from a stage with specified name.

Parameters:
  `stageName` - Stage name to start with.
  `evt` - Event tp process.
  `evts` - Optional events.
Throws:
  `IgniteException` - If event submission failed.

#### addEvents

    void addEvents(Collection<?> evts)
                   throws IgniteException

Submits group of events for processing. This group of events will be processed on default stage, i.e. stage that is the first in the streamer stages list.

Parameters:
  `evts` - Events to add.
Throws:
  `IgniteException` - If event submission failed.

#### addEventsToStage

    void addEventsToStage(String stageName,
                        Collection<?> evts)
                          throws IgniteException

Submits events to streamer. Events will be processed from a stage with specified name.

Parameters:
  `stageName` - Stage name to start with.
  `evts` - Events to process.
Throws:
  `IgniteException` - If event submission failed.

#### context

    StreamerContext context()

Gets streamer context. Streamer context provides access to streamer local space on this node, configured streamer windows and provides various methods to run streamer queries.

Returns:
  Streamer context.

#### addStreamerFailureListener

    void addStreamerFailureListener(StreamerFailureListener lsnr)

Adds streamer failure listener. Listener will be notified on node on which failure occurred in case if `StreamerConfiguration.isAtLeastOnce()` is set to `false` and on node which originated pipeline execution otherwise.

Parameters:
  `lsnr` - Listener to add.

#### removeStreamerFailureListener

    void removeStreamerFailureListener(StreamerFailureListener lsnr)

Removes streamer failure listener.

Parameters:
  `lsnr` - Listener to remove.

#### metrics

    StreamerMetrics metrics()

Gets current streamer metrics.

Returns:
  Streamer metrics.

#### reset

    void reset()

Resets all configured streamer windows by calling `StreamerWindow.reset()` on each and clears local space.

This is local method, it will clear only local windows and local space. Note that windows and space will not be cleaned while stages are executing, i.e. all currently running stages will have to complete before streamer can be reset.

#### resetMetrics

    void resetMetrics()

Resets all streamer metrics.

#### deployClass

    void deployClass(Class<?> depCls)

Explicitly sets deployment class. Will be used only if peer-to-peer class loading is enabled.

Parameters:
  `depCls` - Deployment class.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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