Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-1093

ClassCastException when doing pub/sub from RedisStaticMasterReplicaConfiguration

    XMLWordPrintable

Details

    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
      

      Attachments

        Activity

          People

            mp911de Mark Paluch
            ryanrich Ryan Rich
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: