.setBody(new SimpleExpression(bodyMap.toString()))
.convertBodyTo(Map.class)
Aren't you converting the object twice? First to a String and then telling
it to convert the String to a Map (which it doesn't know how to handle)?
bodyMap.toString(). Assuming it does that correctly you are now passing it
to a converter and telling it to convert the string to a map. Perhaps put
some .log("${body}") in between them and see what you are getting there.
On Sat, Apr 9, 2016 at 9:33 PM, VinothKR <[email protected]> wrote:
> Hi,
> I'm accessing a route through both producertemplate and a QuartzScheduler.
>
> *Route:*
> <route id="uaasRoute">
> <from uri="direct:hivein" />
> <setBody>
> <el>select * from table where empId=${in.body.EmpId}</el>
> </setBody>
> <to uri="jdbc:hive-ds?resetAutoCommit=false" />
> <to uri="mock:result" />
> </route>
>
> *I'm able to successfully pass employee id using producer template like
> below,*
>
> Map<String,Object> bodyMap = new HashMap<String,Object>();
> bodyMap.put("EmpId", "23456");
> Object out = ProducerTemplate.requestBody("direct:hivein",bodyMap);
>
> But unable to achieve the same using quartzScheduler route,
> camel.addRoutes( new RouteBuilder() {
> @Override
> public void configure() throws Exception {
>
> from("quartz2://sampleGroup/sampleTimer?trigger.repeatCount=1")
> .routeId("scheduler").noAutoStartup()
> .setBody(new
> SimpleExpression(bodyMap.toString()))
> .convertBodyTo(Map.class)
> .to("direct:hivein");
> }
> });
>
> Facing the issue,
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
> converter available to convert from type: java.lang.String to the required
> type: java.util.Map
>
> Is there any other way to achieve similar logic as ProducerTemplate in
> QuartzScheduler?
>
> Thanks,
> Vinoth.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-route-set-map-object-in-body-tp5780863.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>