K
- Key type.V
- Value type.public class StatefulRedisPubSubConnectionImpl<K,V> extends StatefulRedisConnectionImpl<K,V> implements StatefulRedisPubSubConnection<K,V>
StatefulRedisPubSubConnectionImpl
A ConnectionWatchdog
monitors each connection and reconnects automatically until RedisChannelHandler.close()
is called. All
pending commands will be (re)sent after successful reconnection.Constructor and Description |
---|
StatefulRedisPubSubConnectionImpl(PubSubEndpoint<K,V> endpoint,
RedisChannelWriter writer,
RedisCodec<K,V> codec,
Duration timeout)
Initialize a new connection.
|
Modifier and Type | Method and Description |
---|---|
void |
activated()
Notification when the connection becomes active (connected).
|
void |
addListener(RedisPubSubListener<K,V> listener)
Add a new listener.
|
RedisPubSubAsyncCommands<K,V> |
async()
Returns the
RedisAsyncCommands API for the current connection. |
protected RedisPubSubAsyncCommandsImpl<K,V> |
newRedisAsyncCommandsImpl()
Create a new instance of
RedisAsyncCommandsImpl . |
protected RedisPubSubReactiveCommandsImpl<K,V> |
newRedisReactiveCommandsImpl()
Create a new instance of
RedisReactiveCommandsImpl . |
protected RedisPubSubCommands<K,V> |
newRedisSyncCommandsImpl()
Create a new instance of
RedisCommands . |
RedisPubSubReactiveCommands<K,V> |
reactive()
Returns the
RedisReactiveCommands API for the current connection. |
void |
removeListener(RedisPubSubListener<K,V> listener)
Remove an existing listener.
|
protected List<RedisFuture<Void>> |
resubscribe()
Re-subscribe to all previously subscribed channels and patterns.
|
RedisPubSubCommands<K,V> |
sync()
Returns the
RedisCommands API for the current connection. |
addListener, dispatch, dispatch, getCodec, getConnectionState, isMulti, preProcessCommand, removeListener, setClientName
addListener, addListener, close, closeAsync, deactivated, flushCommands, getChannelWriter, getConnectionEvents, getOptions, getResources, getTimeout, isClosed, isOpen, registerCloseables, removeListener, reset, setAutoFlushCommands, setOptions, setTimeout, syncHandler
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListener, isMulti, removeListener
addListener, close, closeAsync, dispatch, dispatch, flushCommands, getOptions, getResources, getTimeout, isOpen, removeListener, reset, setAutoFlushCommands, setTimeout
public StatefulRedisPubSubConnectionImpl(PubSubEndpoint<K,V> endpoint, RedisChannelWriter writer, RedisCodec<K,V> codec, Duration timeout)
endpoint
- the PubSubEndpoint
writer
- the writer used to write commandscodec
- Codec used to encode/decode keys and values.timeout
- Maximum time to wait for a response.public void addListener(RedisPubSubListener<K,V> listener)
addListener
in interface StatefulRedisPubSubConnection<K,V>
listener
- Listener.public void removeListener(RedisPubSubListener<K,V> listener)
removeListener
in interface StatefulRedisPubSubConnection<K,V>
listener
- Listener.public RedisPubSubAsyncCommands<K,V> async()
StatefulRedisConnection
RedisAsyncCommands
API for the current connection. Does not create a new connection.async
in interface StatefulRedisConnection<K,V>
async
in interface StatefulRedisPubSubConnection<K,V>
async
in class StatefulRedisConnectionImpl<K,V>
protected RedisPubSubAsyncCommandsImpl<K,V> newRedisAsyncCommandsImpl()
StatefulRedisConnectionImpl
RedisAsyncCommandsImpl
. Can be overriden to extend.newRedisAsyncCommandsImpl
in class StatefulRedisConnectionImpl<K,V>
public RedisPubSubCommands<K,V> sync()
StatefulRedisConnection
RedisCommands
API for the current connection. Does not create a new connection.sync
in interface StatefulRedisConnection<K,V>
sync
in interface StatefulRedisPubSubConnection<K,V>
sync
in class StatefulRedisConnectionImpl<K,V>
protected RedisPubSubCommands<K,V> newRedisSyncCommandsImpl()
StatefulRedisConnectionImpl
RedisCommands
. Can be overriden to extend.newRedisSyncCommandsImpl
in class StatefulRedisConnectionImpl<K,V>
public RedisPubSubReactiveCommands<K,V> reactive()
StatefulRedisConnection
RedisReactiveCommands
API for the current connection. Does not create a new connection.reactive
in interface StatefulRedisConnection<K,V>
reactive
in interface StatefulRedisPubSubConnection<K,V>
reactive
in class StatefulRedisConnectionImpl<K,V>
protected RedisPubSubReactiveCommandsImpl<K,V> newRedisReactiveCommandsImpl()
StatefulRedisConnectionImpl
RedisReactiveCommandsImpl
. Can be overriden to extend.newRedisReactiveCommandsImpl
in class StatefulRedisConnectionImpl<K,V>
protected List<RedisFuture<Void>> resubscribe()
public void activated()
RedisChannelHandler
activated
in interface ConnectionFacade
activated
in class RedisChannelHandler<K,V>
Copyright © 2023 lettuce.io. All rights reserved.