public class PubSubEndpoint<K,V> extends DefaultEndpoint
channel
Constructor and Description |
---|
PubSubEndpoint(ClientOptions clientOptions,
ClientResources clientResources)
Initialize a new instance that handles commands from the supplied queue.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(RedisPubSubListener<K,V> listener)
Add a new
listener . |
protected boolean |
containsViolatingCommands(Collection<? extends RedisCommand<?,?,?>> redisCommands) |
Set<K> |
getChannels() |
protected List<RedisPubSubListener<K,V>> |
getListeners() |
Set<K> |
getPatterns() |
boolean |
hasChannelSubscriptions() |
boolean |
hasPatternSubscriptions() |
void |
notifyChannelActive(Channel channel)
Notify about channel activation.
|
protected void |
notifyListeners(PubSubMessage<K,V> message) |
protected void |
rejectCommand(RedisCommand<?,?,?> command) |
protected void |
rejectCommands(Collection<? extends RedisCommand<?,?,?>> redisCommands) |
void |
removeListener(RedisPubSubListener<K,V> listener)
Remove an existing
listener . |
<K1,V1> Collection<RedisCommand<K1,V1,?>> |
write(Collection<? extends RedisCommand<K1,V1,?>> redisCommands)
Write multiple commands on the channel.
|
<K1,V1,T> RedisCommand<K1,V1,T> |
write(RedisCommand<K1,V1,T> command)
Write a command on the channel.
|
addListener, close, closeAsync, disconnect, doExclusive, drainCommands, flushCommands, getClientResources, getPushListeners, initialState, isClosed, logPrefix, notifyChannelInactive, notifyDrainQueuedCommands, notifyException, registerConnectionWatchdog, removeListener, reset, setAutoFlushCommands, setConnectionFacade, writeToBuffer
public PubSubEndpoint(ClientOptions clientOptions, ClientResources clientResources)
clientOptions
- client options for this connection, must not be null
clientResources
- client resources for this connection, must not be null
.public void addListener(RedisPubSubListener<K,V> listener)
listener
.listener
- the listener, must not be null
.public void removeListener(RedisPubSubListener<K,V> listener)
listener
.listener
- the listener, must not be null
.protected List<RedisPubSubListener<K,V>> getListeners()
public boolean hasChannelSubscriptions()
public boolean hasPatternSubscriptions()
public void notifyChannelActive(Channel channel)
Endpoint
notifyChannelActive
in interface Endpoint
notifyChannelActive
in class DefaultEndpoint
channel
- the channelpublic <K1,V1,T> RedisCommand<K1,V1,T> write(RedisCommand<K1,V1,T> command)
RedisChannelWriter
write
in interface RedisChannelWriter
write
in class DefaultEndpoint
T
- result typecommand
- the Redis command.public <K1,V1> Collection<RedisCommand<K1,V1,?>> write(Collection<? extends RedisCommand<K1,V1,?>> redisCommands)
RedisChannelWriter
write
in interface RedisChannelWriter
write
in class DefaultEndpoint
K1
- key typeV1
- value typeredisCommands
- the Redis commands.protected void rejectCommand(RedisCommand<?,?,?> command)
protected void rejectCommands(Collection<? extends RedisCommand<?,?,?>> redisCommands)
protected boolean containsViolatingCommands(Collection<? extends RedisCommand<?,?,?>> redisCommands)
protected void notifyListeners(PubSubMessage<K,V> message)
Copyright © 2021 lettuce.io. All rights reserved.