org.apache.ignite.streamer.router

## Class StreamerCacheAffinityEventRouter

- java.lang.Object
- - org.apache.ignite.streamer.StreamerEventRouterAdapter
  - - org.apache.ignite.streamer.router.StreamerCacheAffinityEventRouter

All Implemented Interfaces:
  StreamerEventRouter

    public class StreamerCacheAffinityEventRouter
    extends StreamerEventRouterAdapter

Router used to colocate streamer events with data stored in a partitioned cache.

# Affinity Key

Affinity key for collocation of event together on the same node is specified via `StreamerCacheAffinityEventRouter.CacheAffinityEvent.affinityKey()` method. If event does not implement `StreamerCacheAffinityEventRouter.CacheAffinityEvent` interface, then event will be routed always to local node.

### Nested Class Summary

Nested Classes
`static interface` `StreamerCacheAffinityEventRouter.CacheAffinityEvent` All events that implement this interface will be routed based on key affinity.

### Constructor Summary

Constructors
Constructor and Description
`StreamerCacheAffinityEventRouter()`

### Method Summary

Methods
`<T> ClusterNode` `route(StreamerContext ctx, String stageName, T evt)` Selects a node for given event that should be processed by a stage with given name.

### Methods inherited from class org.apache.ignite.streamer.StreamerEventRouterAdapter

`route`

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

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

### Constructor Detail

#### StreamerCacheAffinityEventRouter

    public StreamerCacheAffinityEventRouter()

### Method Detail

#### route

    public <T> ClusterNode route(StreamerContext ctx,
                        String stageName,
                        T evt)

Selects a node for given event that should be processed by a stage with given name.

Parameters:
  `ctx` - Streamer context.
  `stageName` - Stage name.
  `evt` - Event to route.
Returns:
  Node to route to. If this method returns `null` then the whole pipeline execution will be terminated. All running and ongoing stages for pipeline execution will be cancelled.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

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