from(“jetty:http://0.0.0.0:6060/updateData”)
.log(“Received update request: ${body}”)
.setBody(simple(“UPDATE my_table SET data = :#${body[data]} WHERE id = :#${body[id]}”))
.to(“sql:update”) // Replace with your actual SQL query and dataSource
.setBody(simple(“Data updated at ${date:now:yyyy-MM-dd HH:mm:ss}”))
.to(“direct:notifyServiceB”);
I tried body.id and body.data but its not working
Source ID Processor Elapsed (ms)
route1/route1 from[jetty:http://0.0.0.0:6060/updateData] 88
…
route1/setBody1 setBody[simple{UPDATE my_table SET data = :#${body 0
Stacktrace
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: [data] on org.apache.camel.converter.stream.InputStreamCache due to: java.lang.IndexOutOfBoundsException: Key: data not found in bean: org.apache.camel.converter.stream.InputStreamCache@8bc328c of type: org.apache.camel.converter.stream.InputStreamCache using OGNL path [[data]]
AAYUSHI JAIN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.