Search code examples
redisspring-cloud-streamspring-cloud-dataflow

Redis serializer properties in SCDF


I'm using a splitter and an aggregator in SCDF 2.10.3 and I want to cache messages in Redis.

Here is a simple example stream : http | splitter | aggregator | log

This stream works fine without Redis. But when I added Redis configuration to the aggregator, I get an serialization exception because the object does not implement Serializable. This is an known problem with Redis default serializer but I can't find a way to set GenericJackson2JsonRedisSerializer class as Redis serializer through the properties I pass to the stream and I prefer not to fork the aggregator app !

Is there a way to change the Redis serializer with a property ?


Solution

  • There is no way to do that via properties. Feel free to raise a GH issue and we will think what and how can be done from the project perspective.

    Only solution I see at the moment is to have your own RedisMessageStore bean with respective GenericJackson2JsonRedisSerializer injected. Keep in mind that this one has to be supplied with a JacksonJsonUtils.messagingAwareMapper() for a proper Message abstraction (de)serialization.

    See more info in Spring Cloud DataFlow how to enhance a classpath for steam applications: https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#extend-classpath