Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Complete
-
2.2.4 (Moore SR4)
-
None
-
None
Description
When trying to use connections created through a LettuceConnectionFactory configured with a RedisStaticMasterReplicaConfiguration (for use with ElastiCache) you get ClassCastExceptions when trying to do pub/sub:
[RedisMessageListenerContainer]-[656 ]-SubscriptionTask aborted with exception: org.springframework.data.redis.RedisSystemException: Unknown redis exception; nested exception is java.lang.ClassCastException: Cannot cast io.lettuce.core.masterslave.StatefulRedisMasterSlaveConnectionImpl to io.lettuce.core.pubsub.StatefulRedisPubSubConnection at org.springframework.data.redis.FallbackExceptionTranslationStrategy.getFallback(FallbackExceptionTranslationStrategy .java:53) at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.j ava:43) at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection. java:270) at org.springframework.data.redis.connection.lettuce.LettuceConnection.pSubscribe(LettuceConnection.java:820) at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.eventuallyPerformSubscription (RedisMessageListenerContainer.java:785) at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.run(RedisMessageListenerConta iner.java:752) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassCastException: Cannot cast io.lettuce.core.masterslave.StatefulRedisMasterSlaveConnectionImpl to io.lettuce.core.pubsub.StatefulRedisPubSubConnection at java.lang.Class.cast(Class.java:3397) at org.springframework.data.redis.connection.lettuce.StaticMasterReplicaConnectionProvider.getConnection(StaticMasterReplicaConnectionProvider.java:79) at org.springframework.data.redis.connection.lettuce.LettuceConnection.switchToPubSub(LettuceConnection.java:882) at org.springframework.data.redis.connection.lettuce.LettuceConnection.initSubscription(LettuceConnection.java:886) at org.springframework.data.redis.connection.lettuce.LettuceConnection.pSubscribe(LettuceConnection.java:817) ... 3 common frames omitted