camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VinothKR <vinsmai...@gmail.com>
Subject Camel route set map object in body
Date Sun, 10 Apr 2016 02:33:41 GMT
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.

Mime
View raw message