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.LifecycleStateChannelHandler.Sharablebuffer, 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 |
afterComplete(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, writeToDisconnectedBufferbind, close, connect, deregister, disconnect, flush, readchannelReadComplete, channelWritabilityChangedensureNotSharable, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAdded, handlerRemovedpublic 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 ChannelInboundHandlerchannelInactive in class CommandHandler<K,V>ExceptionChannelInboundHandlerAdapter.channelInactive(io.netty.channel.ChannelHandlerContext)protected void decode(ChannelHandlerContext ctx, ByteBuf buffer)
decode in class CommandHandler<K,V>protected boolean canDecode(ByteBuf buffer)
CommandHandlercanDecode in class CommandHandler<K,V>protected boolean canComplete(RedisCommand<?,?,?> command)
CommandHandlercanComplete in class CommandHandler<K,V>protected void complete(RedisCommand<?,?,?> command)
CommandHandlercomplete in class CommandHandler<K,V>RedisCommand.complete()protected CommandOutput<K,V,?> getCommandOutput(RedisCommand<K,V,?> command)
CommandHandlerCommandOutput for RedisCommand decoding.getCommandOutput in class CommandHandler<K,V>RedisCommand.getOutput()protected void afterComplete(ChannelHandlerContext ctx, RedisCommand<K,V,?> command)
CommandHandlerafterComplete in class CommandHandler<K,V>Copyright © 2018 lettuce.io. All rights reserved.