Redis serialization prefixed with extra string

血红的双手。 提交于 2019-12-05 17:57:28

I finally found the answer after five or six hours of googling and implementing on my development machine.

Camel serializer URI options is only for CONSUMER. To affect PRODUCER, I also need to configure a custom RedisTemplate with StringRedisSerializer as default serializer.

redisTemplate.setDefaultSerializer(new StringRedisSerializer());

Then put both the serializer and redis template instance in registry and reference it from Camel URI.

registry.put("customTemplate", template);
registry.put("stringSerializer", new StringRedisSerializer());

Camel URI is like...

redis://<host>:<port>?redisTemplate=#customTemplate&serializer=#stringSerializer
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!