K
- Key type.V
- Value type.public class PubSubCommandHandler<K,V> extends CommandHandler<K,V>
ChannelHandler
responsible for writing Redis Pub/Sub commands and reading the response stream from the
server. PubSubCommandHandler
accounts for Pub/Sub message notification calling back
ChannelHandlerContext.fireChannelRead(Object)
. Redis responses can be interleaved in the sense that a response
contains a Pub/Sub message first, then a command response. Possible interleave is introspected via
ResponseHeaderReplayOutput
and decoding hooks.CommandHandler.LifecycleState
ChannelHandler.Sharable
buffer, channel, clientOptions, clientResources, commandBuffer, commandHandlerId, disconnectedBuffer, rsm, stack, stateLock, writers
Constructor and Description |
---|
PubSubCommandHandler(ClientOptions clientOptions,
ClientResources clientResources,
RedisCodec<K,V> codec)
Initialize a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterDecode(ChannelHandlerContext ctx,
RedisCommand<K,V,?> command)
Hook method called after command completion.
|
protected boolean |
canComplete(RedisCommand<?,?,?> command)
Decoding hook: Can the command be completed.
|
protected boolean |
canDecode(ByteBuf buffer)
Decoding hook: Can the buffer be decoded to a command.
|
void |
channelInactive(ChannelHandlerContext ctx) |
protected void |
complete(RedisCommand<?,?,?> command)
Decoding hook: Complete a command.
|
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf buffer) |
protected CommandOutput<K,V,?> |
getCommandOutput(RedisCommand<K,V,?> command)
Decoding hook: Retrieve
CommandOutput for RedisCommand decoding. |
channelActive, channelRead, channelRegistered, channelUnregistered, close, decrementWriters, drainCommands, drainCommands, exceptionCaught, flushCommands, getStack, getState, incrementWriters, initialState, isClosed, lockWritersExclusive, logPrefix, prepareReset, reset, setAutoFlushCommands, setRedisChannelHandler, setState, unlockWritersExclusive, userEventTriggered, write, write, writeToDisconnectedBuffer
bind, close, connect, deregister, disconnect, flush, read
channelReadComplete, channelWritabilityChanged
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded, handlerRemoved
public PubSubCommandHandler(ClientOptions clientOptions, ClientResources clientResources, RedisCodec<K,V> codec)
clientOptions
- client options for the connectionclientResources
- client resources for this connectioncodec
- Codec.public void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive
in interface ChannelInboundHandler
channelInactive
in class CommandHandler<K,V>
Exception
ChannelInboundHandlerAdapter.channelInactive(io.netty.channel.ChannelHandlerContext)
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer)
decode
in class CommandHandler<K,V>
protected boolean canDecode(ByteBuf buffer)
CommandHandler
canDecode
in class CommandHandler<K,V>
protected boolean canComplete(RedisCommand<?,?,?> command)
CommandHandler
canComplete
in class CommandHandler<K,V>
protected void complete(RedisCommand<?,?,?> command)
CommandHandler
complete
in class CommandHandler<K,V>
RedisCommand.complete()
protected CommandOutput<K,V,?> getCommandOutput(RedisCommand<K,V,?> command)
CommandHandler
CommandOutput
for RedisCommand
decoding.getCommandOutput
in class CommandHandler<K,V>
RedisCommand.getOutput()
protected void afterDecode(ChannelHandlerContext ctx, RedisCommand<K,V,?> command)
CommandHandler
afterDecode
in class CommandHandler<K,V>
Copyright © 2018 lettuce.io. All rights reserved.