DATAREDIS-1093 - Document that Master/Replica connections do not support Pub/Sub.
This commit is contained in:
@@ -27,6 +27,7 @@ import org.springframework.util.Assert;
|
||||
* Master / Replica configuration to nodes know to not change address. Eg. when connecting to
|
||||
* <a href="https://aws.amazon.com/documentation/elasticache/">AWS ElastiCache with Read Replicas</a>. <br/>
|
||||
* Note: Redis is undergoing a nomenclature change where the term replica is used synonymously to slave.
|
||||
* Please also note that a Master/Replica connection cannot be used for Pub/Sub operations.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
|
||||
@@ -22,6 +22,7 @@ import io.lettuce.core.api.StatefulConnection;
|
||||
import io.lettuce.core.codec.RedisCodec;
|
||||
import io.lettuce.core.masterreplica.MasterReplica;
|
||||
import io.lettuce.core.masterreplica.StatefulRedisMasterReplicaConnection;
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
@@ -70,6 +71,10 @@ class StaticMasterReplicaConnectionProvider implements LettuceConnectionProvider
|
||||
@Override
|
||||
public <T extends StatefulConnection<?, ?>> T getConnection(Class<T> connectionType) {
|
||||
|
||||
if (connectionType.equals(StatefulRedisPubSubConnection.class)) {
|
||||
throw new UnsupportedOperationException("Pub/Sub connections not supported with Master/Replica configurations");
|
||||
}
|
||||
|
||||
if (StatefulConnection.class.isAssignableFrom(connectionType)) {
|
||||
|
||||
StatefulRedisMasterReplicaConnection<?, ?> connection = MasterReplica.connect(client, codec, nodes);
|
||||
|
||||
Reference in New Issue
Block a user