org.apache.ignite.internal

## Class GridMessageListenHandler

- java.lang.Object
- - org.apache.ignite.internal.GridMessageListenHandler

All Implemented Interfaces:
  Externalizable, Serializable, Cloneable, GridContinuousHandler

    public class GridMessageListenHandler
    extends Object
    implements GridContinuousHandler

Continuous handler for message subscription.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.continuous.GridContinuousHandler

`GridContinuousHandler.RegisterStatus`

### Constructor Summary

Constructors
Constructor and Description
`GridMessageListenHandler()` Required by `Externalizable`.
`GridMessageListenHandler(GridMessageListenHandler orig)`
`GridMessageListenHandler(Object topic, IgniteBiPredicate<UUID,Object> pred)`

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `cacheName()`
`GridContinuousHandler` `clone()` Clones this handler.
`GridContinuousBatch` `createBatch()` Creates new batch.
`boolean` `isEvents()`
`boolean` `isMessaging()`
`boolean` `isQuery()`
`boolean` `keepBinary()`
`void` `notifyCallback(UUID nodeId, UUID routineId, Collection<?> objs, GridKernalContext ctx)` Notifies local callback.
`void` `onBatchAcknowledged(UUID routineId, GridContinuousBatch batch, GridKernalContext ctx)` Called when ack for a batch is received from client.
`void` `onClientDisconnected()` Client node disconnected callback.
`void` `onNodeLeft()` Node which started routine leave topology.
`Object` `orderedTopic()`
`void` `p2pMarshal(GridKernalContext ctx)` Deploys and marshals inner objects (called only if peer deployment is enabled).
`void` `p2pUnmarshal(UUID nodeId, GridKernalContext ctx)` Unmarshals inner objects (called only if peer deployment is enabled).
`void` `readExternal(ObjectInput in)`
`GridContinuousHandler.RegisterStatus` `register(UUID nodeId, UUID routineId, GridKernalContext ctx)` Registers listener.
`String` `toString()`
`void` `unregister(UUID routineId, GridKernalContext ctx)` Unregisters listener.
`void` `updateCounters(AffinityTopologyVersion topVer, Map<UUID,Map<Integer,T2<Long,Long>>> cntrsPerNode, Map<Integer,T2<Long,Long>> cntrs)`
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### GridMessageListenHandler

    public GridMessageListenHandler()

Required by `Externalizable`.

#### GridMessageListenHandler

    public GridMessageListenHandler(@Nullable
                                    Object topic,
                                    IgniteBiPredicate<UUID,Object> pred)

Parameters:
  `topic` - Topic.
  `pred` - Predicate.

#### GridMessageListenHandler

    public GridMessageListenHandler(GridMessageListenHandler orig)

Parameters:
  `orig` - Handler to be copied.

### Method Detail

#### isEvents

    public boolean isEvents()

Specified by:
  `isEvents` in interface `GridContinuousHandler`
Returns:
  `True` if for events.

#### isMessaging

    public boolean isMessaging()

Specified by:
  `isMessaging` in interface `GridContinuousHandler`
Returns:
  `True` if for messaging.

#### isQuery

    public boolean isQuery()

Specified by:
  `isQuery` in interface `GridContinuousHandler`
Returns:
  `True` if for continuous queries.

#### keepBinary

    public boolean keepBinary()

Specified by:
  `keepBinary` in interface `GridContinuousHandler`
Returns:
  `True` if Ignite Binary objects should be passed to the listener and filter.

#### cacheName

    public String cacheName()

Specified by:
  `cacheName` in interface `GridContinuousHandler`
Returns:
  Cache name if this is a continuous query handler.

#### updateCounters

    public void updateCounters(AffinityTopologyVersion topVer,
                               Map<UUID,Map<Integer,T2<Long,Long>>> cntrsPerNode,
                               Map<Integer,T2<Long,Long>> cntrs)

Specified by:
  `updateCounters` in interface `GridContinuousHandler`
Parameters:
  `topVer` - Topology version.
  `cntrsPerNode` - Init state partition counters for node.
  `cntrs` - Init state for partition counters.

#### register

    public GridContinuousHandler.RegisterStatus register(UUID nodeId,
                                                         UUID routineId,
                                                         GridKernalContext ctx)
                                                  throws IgniteCheckedException

Registers listener.

Specified by:
  `register` in interface `GridContinuousHandler`
Parameters:
  `nodeId` - ID of the node that started routine.
  `routineId` - Routine ID.
  `ctx` - Kernal context.
Returns:
  Whether listener was actually registered.
Throws:
  `IgniteCheckedException` - In case of error.

#### unregister

    public void unregister(UUID routineId,
                           GridKernalContext ctx)

Unregisters listener.

Specified by:
  `unregister` in interface `GridContinuousHandler`
Parameters:
  `routineId` - Routine ID.
  `ctx` - Kernal context.

#### notifyCallback

    public void notifyCallback(UUID nodeId,
                               UUID routineId,
                               Collection<?> objs,
                               GridKernalContext ctx)

Notifies local callback.

Specified by:
  `notifyCallback` in interface `GridContinuousHandler`
Parameters:
  `nodeId` - ID of the node where notification came from.
  `routineId` - Routine ID.
  `objs` - Notification objects.
  `ctx` - Kernal context.

#### p2pMarshal

    public void p2pMarshal(GridKernalContext ctx)
                    throws IgniteCheckedException

Deploys and marshals inner objects (called only if peer deployment is enabled).

Specified by:
  `p2pMarshal` in interface `GridContinuousHandler`
Parameters:
  `ctx` - Kernal context.
Throws:
  `IgniteCheckedException` - In case of error.

#### p2pUnmarshal

    public void p2pUnmarshal(UUID nodeId,
                             GridKernalContext ctx)
                      throws IgniteCheckedException

Unmarshals inner objects (called only if peer deployment is enabled).

Specified by:
  `p2pUnmarshal` in interface `GridContinuousHandler`
Parameters:
  `nodeId` - Sender node ID.
  `ctx` - Kernal context.
Throws:
  `IgniteCheckedException` - In case of error.

#### createBatch

    public GridContinuousBatch createBatch()

Creates new batch.

Specified by:
  `createBatch` in interface `GridContinuousHandler`
Returns:
  New batch.

#### onClientDisconnected

    public void onClientDisconnected()

Client node disconnected callback.

Specified by:
  `onClientDisconnected` in interface `GridContinuousHandler`

#### onBatchAcknowledged

    public void onBatchAcknowledged(UUID routineId,
                                    GridContinuousBatch batch,
                                    GridKernalContext ctx)

Called when ack for a batch is received from client.

Specified by:
  `onBatchAcknowledged` in interface `GridContinuousHandler`
Parameters:
  `routineId` - Routine ID.
  `batch` - Acknowledged batch.
  `ctx` - Kernal context.

#### orderedTopic

    @Nullable
    public Object orderedTopic()

Specified by:
  `orderedTopic` in interface `GridContinuousHandler`
Returns:
  Topic for ordered notifications. If `null`, notifications will be sent in non-ordered messages.

#### clone

    public GridContinuousHandler clone()

Clones this handler.

Specified by:
  `clone` in interface `GridContinuousHandler`
Overrides:
  `clone` in class `Object`
Returns:
  Clone of this handler.

#### onNodeLeft

    public void onNodeLeft()

Node which started routine leave topology.

Specified by:
  `onNodeLeft` in interface `GridContinuousHandler`

#### 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`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.6.0
Release Date | : July 10 2018