There is a issue with RedisCodec when using different environment configuration (cluster, non-cluster) when using custom codec.
When developing on localhost i use standalone non-cluster redis. This configuration uses codec created in my factory class.
@Singleton
@Replaces(RedisCodec::class)
@Primary
fun serializedObjectCodec(): RedisCodec<String, Any> =
createJdkSerializerCodec()
But DefaultRedisClusterClientFactory bypassing this codec because not provide codec when call client.connect() like in non-cluster configuration.
This behaviour causes errors on kubernetes where redis-cluster running, because connection uses default lettuce StringCodec instead of user-defined codec.
It is possible to inherit AbstractRedisClientFactory<K, V> like in DefaultRedisClientFactory and create StatefulRedisClusterConnection with user defined codec?
For now i have work around for this issue with custom configuration but i wont have this code in my app.
There is a issue with RedisCodec when using different environment configuration (cluster, non-cluster) when using custom codec.
When developing on localhost i use standalone non-cluster redis. This configuration uses codec created in my factory class.
But
DefaultRedisClusterClientFactory
bypassing this codec because not provide codec when callclient.connect()
like in non-cluster configuration.This behaviour causes errors on kubernetes where redis-cluster running, because connection uses default lettuce StringCodec instead of user-defined codec.
It is possible to inherit AbstractRedisClientFactory<K, V> like in DefaultRedisClientFactory and create StatefulRedisClusterConnection with user defined codec?
For now i have work around for this issue with custom configuration but i wont have this code in my app.
This is the class which, i think, need improvements.
https://github.com/micronaut-projects/micronaut-redis/blob/80009dc2bec103e499e992e5ddfdfc6d8513adb7/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/DefaultRedisClusterClientFactory.java#L45