Question

I try to do a simple test where I read values from redis and print them to the console. However, although the program compiles and runs, it does not print anything to the console (yes, the testKEY is present in Redis). Why would that be?

private static class MyRouteBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("spring-redis://localhost:6379?command=GET&serializer=#serializer")
        .setHeader("CamelRedis.Key", constant("testKEY"))
        .to("stream:out");
    }
}
Was it helpful?

Solution 2

Camel Redis consumer can subscribe to a PUB/SUB channel and receive notifications. It cannot perform get or other operations. If you want to read/get a value from redis, you have to use a producer endpoint.

OTHER TIPS

You could try something like:

from("timer:redisPoll?period=30000")
    .setHeader("CamelRedis.Key", constant("testKEY"))
    .to("spring-redis://localhost:6379?command=GET&serializer=#serializer")
    .to("stream:out");

This should issue a Get test Key on Redis every 30s and print the result to console.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top