org.apache.ignite.internal.processors.streamer

## Class IgniteStreamerImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.streamer.IgniteStreamerImpl

All Implemented Interfaces:
  Externalizable, Serializable, IgniteStreamer, IgniteStreamerEx

    public class IgniteStreamerImpl
    extends Object
    implements IgniteStreamerEx, Externalizable

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`IgniteStreamerImpl()` Empty constructor required by `Externalizable`.
`IgniteStreamerImpl(GridKernalContext ctx, StreamerConfiguration c)`

### 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.
`boolean` `cancelled(IgniteUuid futId)` Checks if cancel request was received for this future ID.
`StreamerConfiguration` `configuration()` Gets streamer configuration.
`StreamerContext` `context()` Gets streamer context.
`void` `deployClass(Class<?> depCls)` Explicitly sets deployment class.
`StreamerEventRouter` `eventRouter()`
`GridKernalContext` `kernalContext()`
`StreamerMetrics` `metrics()` Gets current streamer metrics.
`String` `name()` Gets streamer name.
`void` `onFutureCompleted(GridStreamerStageExecutionFuture fut)` Called when future is completed and parent should be notified, if any.
`void` `onFutureMapped(GridStreamerStageExecutionFuture fut)` Called before execution requests are sent to remote nodes or scheduled for local execution.
`void` `onKernalStop(boolean cancel)` On kernal stop callback.
`void` `onQueryCompleted(long time, int nodes)` Callback executed when streamer query completes.
`void` `onUndeploy(ClassLoader undeployedLdr)` Callback for undeployed class loaders.
`void` `readExternal(ObjectInput in)`
`protected Object` `readResolve()` Reconstructs object on unmarshalling.
`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.
`void` `scheduleExecutions(GridStreamerStageExecutionFuture fut, Map<UUID,GridStreamerExecutionBatch> execs)` Schedules batch executions either on local or on remote nodes.
`void` `start()`
`void` `stop(boolean cancel)`
`String` `toString()`
`<E> StreamerWindow<E>` `window()` Gets streamer default window (the first one in configuration list).
`<E> StreamerWindow<E>` `window(String windowName)` Gets streamer window by window name.
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### IgniteStreamerImpl

    public IgniteStreamerImpl()

Empty constructor required by `Externalizable`.

#### IgniteStreamerImpl

    public IgniteStreamerImpl(GridKernalContext ctx,
                      StreamerConfiguration c)

Parameters:
  `ctx` - Kernal context.
  `c` - Configuration.

### Method Detail

#### start

    public void start()
               throws IgniteCheckedException

Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStop

    public void onKernalStop(boolean cancel)

On kernal stop callback.

Parameters:
  `cancel` - Cancel.

#### stop

    public void stop(boolean cancel)

Parameters:
  `cancel` - Whether currently running tasks should be cancelled.

#### name

    @Nullable
    public String name()

Gets streamer name.

Specified by:
  `name` in interface `IgniteStreamer`
Returns:
  Streamer name, or `null` for default no-name streamer.

#### configuration

    public StreamerConfiguration configuration()

Gets streamer configuration.

Specified by:
  `configuration` in interface `IgniteStreamer`
Returns:
  Streamer configuration.

#### addEvent

    public void addEvent(Object evt,
                Object... evts)

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.

Specified by:
  `addEvent` in interface `IgniteStreamer`
Parameters:
  `evt` - Event to add.
  `evts` - Optional events to add.

#### addEventToStage

    public void addEventToStage(String stageName,
                       Object evt,
                       Object... evts)

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

Specified by:
  `addEventToStage` in interface `IgniteStreamer`
Parameters:
  `stageName` - Stage name to start with.
  `evt` - Event tp process.
  `evts` - Optional events.

#### addEvents

    public void addEvents(Collection<?> evts)

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.

Specified by:
  `addEvents` in interface `IgniteStreamer`
Parameters:
  `evts` - Events to add.

#### addEventsToStage

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

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

Specified by:
  `addEventsToStage` in interface `IgniteStreamer`
Parameters:
  `stageName` - Stage name to start with.
  `evts` - Events to process.

#### context

    public 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.

Specified by:
  `context` in interface `IgniteStreamer`
Returns:
  Streamer context.

#### addStreamerFailureListener

    public 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.

Specified by:
  `addStreamerFailureListener` in interface `IgniteStreamer`
Parameters:
  `lsnr` - Listener to add.

#### removeStreamerFailureListener

    public void removeStreamerFailureListener(StreamerFailureListener lsnr)

Removes streamer failure listener.

Specified by:
  `removeStreamerFailureListener` in interface `IgniteStreamer`
Parameters:
  `lsnr` - Listener to remove.

#### metrics

    public StreamerMetrics metrics()

Gets current streamer metrics.

Specified by:
  `metrics` in interface `IgniteStreamer`
Returns:
  Streamer metrics.

#### reset

    public 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.

Specified by:
  `reset` in interface `IgniteStreamer`

#### resetMetrics

    public void resetMetrics()

Resets all streamer metrics.

Specified by:
  `resetMetrics` in interface `IgniteStreamer`

#### deployClass

    public void deployClass(Class<?> depCls)

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

Specified by:
  `deployClass` in interface `IgniteStreamer`
Parameters:
  `depCls` - Deployment class.

#### window

    public <E> StreamerWindow<E> window()

Gets streamer default window (the first one in configuration list).

Specified by:
  `window` in interface `IgniteStreamerEx`
Returns:
  Streamer window.

#### window

    public <E> StreamerWindow<E> window(String windowName)

Gets streamer window by window name.

Specified by:
  `window` in interface `IgniteStreamerEx`
Parameters:
  `windowName` - Window name.
Returns:
  Streamer window.

#### kernalContext

    public GridKernalContext kernalContext()

Specified by:
  `kernalContext` in interface `IgniteStreamerEx`
Returns:
  Kernal context.

#### onFutureMapped

    public void onFutureMapped(GridStreamerStageExecutionFuture fut)

Called before execution requests are sent to remote nodes or scheduled for local execution.

Specified by:
  `onFutureMapped` in interface `IgniteStreamerEx`
Parameters:
  `fut` - Future.

#### onFutureCompleted

    public void onFutureCompleted(GridStreamerStageExecutionFuture fut)

Called when future is completed and parent should be notified, if any.

Specified by:
  `onFutureCompleted` in interface `IgniteStreamerEx`
Parameters:
  `fut` - Future.

#### eventRouter

    public StreamerEventRouter eventRouter()

Specified by:
  `eventRouter` in interface `IgniteStreamerEx`
Returns:
  Streamer event router.

#### scheduleExecutions

    public void scheduleExecutions(GridStreamerStageExecutionFuture fut,
                          Map<UUID,GridStreamerExecutionBatch> execs)
                            throws IgniteCheckedException

Schedules batch executions either on local or on remote nodes.

Specified by:
  `scheduleExecutions` in interface `IgniteStreamerEx`
Parameters:
  `fut` - Future.
  `execs` - Executions grouped by node ID.
Throws:
  `IgniteCheckedException` - If failed.

#### onUndeploy

    public void onUndeploy(ClassLoader undeployedLdr)

Callback for undeployed class loaders. All deployed events will be removed from window and local storage.

Specified by:
  `onUndeploy` in interface `IgniteStreamerEx`
Parameters:
  `undeployedLdr` - Undeployed class loader.

#### onQueryCompleted

    public void onQueryCompleted(long time,
                        int nodes)

Callback executed when streamer query completes.

Specified by:
  `onQueryCompleted` in interface `IgniteStreamerEx`
Parameters:
  `time` - Consumed time.
  `nodes` - Participating nodes count.

#### cancelled

    public boolean cancelled(IgniteUuid futId)

Checks if cancel request was received for this future ID.

Parameters:
  `futId` - Future ID.
Returns:
  `True` if future was cancelled, `false` otherwise.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### readResolve

    protected Object readResolve()

Reconstructs object on unmarshalling.

Returns:
  Reconstructed object.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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