By the way, when the quartz timer fires what are you expecting that data to
be in the bodyMap?  Is that just an instance variable at that point?
Perhaps if you posted the complete code it would make that a bit clearer.
>From what I can see of your route snippet I'd expect some quartz timer
event to be received. Again, putting a .log() statement in there would let
you see what you are getting.  If you look at an example of Quartz in
action from the Camel web page you can see.

from("file:inbox?scheduler=quartz2&scheduler.cron=0/2+*+*+*+*+?")
   .to("bean:process");

You can see that it is using the timer to fire a read from a file. In your
case you appear to be firing the timer and sending a timer event into your
route.  It's been a while since I've used Quartz so take that observation
with a grain of salt but I'd definitely put a log statement in to see what
you are getting there.

Brad


On Sat, Apr 9, 2016 at 10:47 PM, Brad Johnson <brad.john...@mediadriver.com>
wrote:

>   .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 <vinsmai...@gmail.com> 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.
>>
>
>

Reply via email to