Hi Team,
I am trying to integrate camel with redis server to perform GET and SET operations , Below is my camel context. Not getting any Errors but also SET/GET operations not returning anything. When checked in redis-CLI nothing was saved in the server. *Camel Context Xml:* <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd" > <bean id="camelConnectionFactory" class=" org.springframework.data.redis.connection.jedis.JedisConnectionFactory"/> <bean id="redisTemplate" class=" org.springframework.data.redis.core.RedisTemplate"> <property name="connectionFactory" ref="camelConnectionFactory"/> </bean> <camelContext xmlns=http://camel.apache.org/schema/spring> <route> <from uri="direct:getDataFromRedis"/> <log message="Received message: ${body}"/> <setHeader name="CamelRedis.Key"> <constant>${body}</constant> </setHeader> <to uri="spring-redis:// 127.0.0.1:6379?connectionFactory=#camelConnectionFactory& redisTemplate=#redisTemplate&command=GET"/> </route> <route> <from uri="direct:setDataToRedis"/> <log message="Received Key: ${body.id}"/> <log message="Received Value: ${body.name}"/> <setHeader name="CamelRedis.Key"> <constant>${body.id}</constant> </setHeader> <setHeader name="CamelRedis.Value"> <constant>${body.name}</constant> </setHeader> <to uri="spring-redis:// 127.0.0.1:6379?connectionFactory=#camelConnectionFactory& redisTemplate=#redisTemplate&command=SET"/> </route> </camelContext> </beans> Employee.java *public* *class* Employee { *public* String id; *public* String name; *public* String getId() { *return* id; } *public* *void* setId(String id) { *this*.id = id; } *public* String getName() { *return* name; } *public* *void* setName(String name) { *this*.name = name; } } Controller: package com.camel.redis.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import com.camel.redis.mapper.Employee; import com.fasterxml.jackson.databind.util.JSONPObject; import org.apache.camel.CamelContext; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @RestController public class RedisCamelController { @Autowired CamelContext camelContext; @Autowired public RedisCamelController(CamelContext camelContext) { this.camelContext = camelContext; } @GetMapping(value="/getEmployeeDetails/{key}") public String getValueFromRedis(@PathVariable String key) throws Exception { String messageBody = key; String result = camelContext.createProducerTemplate() .requestBody("direct:getDataFromRedis", messageBody, String.class); return result; } @PostMapping(value="/setEmployeeDetails/{key}/{value}") public String getValueFromRedis(@PathVariable String key,@PathVariable String value) throws Exception { Employee emp=new Employee(); emp.setId(key); emp.setName(value); String result = camelContext.createProducerTemplate() .requestBody("direct:setDataToRedis",emp, String.class); return result; } } Console : 2023-08-09 11:07:07.458[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mc.c.r.SpringbootcamelRedisApplication [0;39m [2m:[0;39m No active profile set, falling back to 1 default profile: "default" [2m2023-08-09 11:07:09.604[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Multiple Spring Data modules found, entering strict repository configuration mode [2m2023-08-09 11:07:09.610[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Bootstrapping Spring Data Redis repositories in DEFAULT mode. [2m2023-08-09 11:07:09.665[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36m.s.d.r.c.RepositoryConfigurationDelegate[0;39m [2m:[0;39m Finished Spring Data repository scanning in 10 ms. Found 0 Redis repository interfaces. [2m2023-08-09 11:07:09.973[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mtrationDelegate$BeanPostProcessorChecker[0;39m [2m:[0;39m Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$df84134f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) [2m2023-08-09 11:07:10.034[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36m.w.s.a.s.AnnotationActionEndpointMapping[0;39m [2m:[0;39m Supporting [WS-Addressing August 2004, WS-Addressing 1.0] [2m2023-08-09 11:07:10.420[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat initialized with port(s): 8082 (http) [2m2023-08-09 11:07:10.434[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Starting service [Tomcat] [2m2023-08-09 11:07:10.434[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet engine: [Apache Tomcat/9.0.75] [2m2023-08-09 11:07:10.646[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext [2m2023-08-09 11:07:10.646[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mw.s.c.ServletWebServerApplicationContext[0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 3099 ms [2m2023-08-09 11:07:12.162[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat started on port(s): 8082 (http) with context path '' [2m2023-08-09 11:07:12.411[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Apache Camel 3.20.5 (camel-1) is starting [2m2023-08-09 11:07:12.447[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Routes startup (started:2) [2m2023-08-09 11:07:12.448[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Started route1 (direct://getDataFromRedis) [2m2023-08-09 11:07:12.448[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Started route2 (direct://setDataToRedis) [2m2023-08-09 11:07:12.448[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Apache Camel 3.20.5 (camel-1) started in 327ms (build:89ms init:203ms start:35ms) [2m2023-08-09 11:07:12.463[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[ main][0;39m [36mc.c.r.SpringbootcamelRedisApplication [0;39m [2m:[0;39m Started SpringbootcamelRedisApplication in 5.714 seconds (JVM running for 19.787) [2m2023-08-09 11:10:53.413[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Initializing Spring DispatcherServlet 'dispatcherServlet' [2m2023-08-09 11:10:53.414[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet [0;39m [2m:[0;39m Initializing Servlet 'dispatcherServlet' [2m2023-08-09 11:10:53.415[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet [0;39m [2m:[0;39m Completed initialization in 1 ms [2m2023-08-09 11:10:53.539[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-1][0;39m [36mroute1 [0;39m [2m:[0;39m Received message: 10077 [2m2023-08-09 11:10:58.393[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-4][0;39m [36mroute2 [0;39m [2m:[0;39m Received Key: 10077 [2m2023-08-09 11:10:58.393[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-4][0;39m [36mroute2 [0;39m [2m:[0;39m Received Value: Kia [2m2023-08-09 11:11:01.974[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-3][0;39m [36mroute1 [0;39m [2m:[0;39m Received message: 10077 [2m2023-08-09 11:12:32.386[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[nio-8082-exec-7][0;39m [36mroute1 [0;39m [2m:[0;39m Received message: 10077 [2m2023-08-09 11:12:37.656[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36minMXBeanRegistrar$SpringApplicationAdmin[0;39m [2m:[0;39m Application shutdown requested. [2m2023-08-09 11:12:37.664[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Apache Camel 3.20.5 (camel-1) is shutting down (timeout:45s) [2m2023-08-09 11:12:37.676[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Routes stopped (stopped:2) [2m2023-08-09 11:12:37.677[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Stopped route2 (direct://setDataToRedis) [2m2023-08-09 11:12:37.677[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Stopped route1 (direct://getDataFromRedis) [2m2023-08-09 11:12:37.681[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.a.c.impl.engine.AbstractCamelContext [0;39m [2m:[0;39m Apache Camel 3.20.5 (camel-1) shutdown in 17ms (uptime:5m25s) [2m2023-08-09 11:12:37.700[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Stopping service [Tomcat] [2m2023-08-09 11:12:37.703[0;39m [32m INFO[0;39m [35m7828[0;39m [2m---[0;39m [2m[on(9)-127.0.0.1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Destroying Spring FrameworkServlet 'dispatcherServlet' Endpoint :GET : http://localhost:8082/getEmployeeDetails/10077 Response : 10077 POST : http://localhost:8082/setEmployeeDetails/10077/Kia Response: com.camel.redis.mapper.Employee@c1272af Regards, Yuvarani A.