K - Key type.V - Value type.public class PubSubCommandHandler<K,V> extends CommandHandler
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
PubSubEndpoint.notifyMessage(PubSubOutput). 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.Sharable| Constructor and Description |
|---|
PubSubCommandHandler(ClientOptions clientOptions,
ClientResources clientResources,
RedisCodec<K,V> codec,
PubSubEndpoint<K,V> endpoint)
Initialize a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterDecode(ChannelHandlerContext ctx,
RedisCommand<?,?,?> 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<?,?,?> |
getCommandOutput(RedisCommand<?,?,?> command)
Decoding hook: Retrieve
CommandOutput for RedisCommand decoding. |
channelActive, channelRead, channelRegistered, channelUnregistered, decode, decode, drainQueue, exceptionCaught, getStack, getState, isClosed, setState, userEventTriggered, writebind, 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, PubSubEndpoint<K,V> endpoint)
clientOptions - client options for this connection, must not be nullclientResources - client resources for this connectioncodec - Codec.endpoint - the Pub/Sub endpoint for Pub/Sub callback.public void channelInactive(ChannelHandlerContext ctx) throws Exception
channelInactive in interface ChannelInboundHandlerchannelInactive in class CommandHandlerExceptionChannelInboundHandlerAdapter.channelInactive(io.netty.channel.ChannelHandlerContext)protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException
decode in class CommandHandlerInterruptedExceptionprotected boolean canDecode(ByteBuf buffer)
CommandHandlercanDecode in class CommandHandlerprotected boolean canComplete(RedisCommand<?,?,?> command)
CommandHandlercanComplete in class CommandHandlerprotected void complete(RedisCommand<?,?,?> command)
CommandHandlercomplete in class CommandHandlerRedisCommand.complete()protected CommandOutput<?,?,?> getCommandOutput(RedisCommand<?,?,?> command)
CommandHandlerCommandOutput for RedisCommand decoding.getCommandOutput in class CommandHandlerRedisCommand.getOutput()protected void afterDecode(ChannelHandlerContext ctx, RedisCommand<?,?,?> command)
CommandHandlerafterDecode in class CommandHandlerCopyright © 2021 lettuce.io. All rights reserved.