org.apache.ignite.internal.processors.rest.protocols.tcp.redis

## Class GridRedisNioListener

- java.lang.Object
- - org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter<GridRedisMessage>
  - - org.apache.ignite.internal.processors.rest.protocols.tcp.redis.GridRedisNioListener

All Implemented Interfaces:
  EventListener, GridNioServerListener<GridRedisMessage>

    public class GridRedisNioListener
    extends GridNioServerListenerAdapter<GridRedisMessage>

Listener for Redis protocol requests.

### Field Summary

Fields
`static int` `CONN_CTX_META_KEY` Connection-related metadata key.
`protected Map<GridRedisCommand,GridRedisCommandHandler>` `handlers` Redis-specific handlers.

### Constructor Summary

Constructors
Constructor and Description
`GridRedisNioListener(IgniteLogger log, GridRestProtocolHandler hnd, GridKernalContext ctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `onConnected(GridNioSession ses)` This method is called whenever a new client is connected and session is created.
`void` `onDisconnected(GridNioSession ses, Exception e)` This method is called whenever client is disconnected due to correct connection close or due to `IOException` during network operations.
`void` `onMessage(GridNioSession ses, GridRedisMessage msg)` This method is called whenever a `GridNioParser` returns non-null value.

### Methods inherited from class org.apache.ignite.internal.util.nio.GridNioServerListenerAdapter

`onFailure, onMessageSent, onSessionIdleTimeout, onSessionWriteTimeout`

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

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

### Field Detail

#### handlers

    protected final Map<GridRedisCommand,GridRedisCommandHandler> handlers

Redis-specific handlers.

#### CONN_CTX_META_KEY

    public static final int CONN_CTX_META_KEY

Connection-related metadata key. Used for cache name only.

### Constructor Detail

#### GridRedisNioListener

    public GridRedisNioListener(IgniteLogger log,
                                GridRestProtocolHandler hnd,
                                GridKernalContext ctx)

Parameters:
  `log` - Logger.
  `hnd` - REST protocol handler.
  `ctx` - Context.

### Method Detail

#### onConnected

    public void onConnected(GridNioSession ses)

This method is called whenever a new client is connected and session is created.

Parameters:
  `ses` - Newly created session for remote client.

#### onDisconnected

    public void onDisconnected(GridNioSession ses,
                               @Nullable
                               Exception e)

This method is called whenever client is disconnected due to correct connection close or due to `IOException` during network operations.

Parameters:
  `ses` - Closed session.
  `e` - Exception occurred, if any.

#### onMessage

    public void onMessage(GridNioSession ses,
                          GridRedisMessage msg)

This method is called whenever a `GridNioParser` returns non-null value.

Parameters:
  `ses` - Session on which message was received.
  `msg` - Parsed message.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018