You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bhushand <bh...@yahoo.co.in> on 2012/04/18 08:15:18 UTC

is it require to keep datatype of inputParams same for all routes??

I am using camel routes. 

<camel:from uri="direct:startRoute"/>
<camel:to uri="bean:firstBean?method=method1"/>
<camel:to uri="bean:SecondBean?method=method2"/>
<camel:to uri="bean:thirdBean?method=method3"/>

method1() needs 5-6 different objects for processing so I have formed a Map
& put required objects in this map. I am passing map using
ProducerTemplate.sendBody("direct:startRoute",map).
I am getting all objects in method1() properly, no issue.

But method2() has signature with input parameter as String, here it is
giving me conversion error saying "no converter available to convert map to
String".
For solving this problem, I put the input param of method2() in map &
passing this map onward.

*Here unnecessarily I have to pass Map to all routes.*

*Is it required that if I am passing an object of one type in sendBody() at
the start of route then I have to continue with same object for rest of
routes. *

I tried for custom converter, but that have to register with camelcontext &
get applied for all routes.
How to solve this problem? Please help me.
Can we have route specific converters? if yes then please tell me how can I
use it.

--
View this message in context: http://camel.465427.n5.nabble.com/is-it-require-to-keep-datatype-of-inputParams-same-for-all-routes-tp5648290p5648290.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: is it require to keep datatype of inputParams same for all routes??

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

For starters I suggest to see the bean component docs and bean binding docs
http://camel.apache.org/bean.html
http://camel.apache.org/bean-binding.html


On Wed, Apr 18, 2012 at 8:15 AM, bhushand <bh...@yahoo.co.in> wrote:
> I am using camel routes.
>
> <camel:from uri="direct:startRoute"/>
> <camel:to uri="bean:firstBean?method=method1"/>
> <camel:to uri="bean:SecondBean?method=method2"/>
> <camel:to uri="bean:thirdBean?method=method3"/>
>
> method1() needs 5-6 different objects for processing so I have formed a Map
> & put required objects in this map. I am passing map using
> ProducerTemplate.sendBody("direct:startRoute",map).
> I am getting all objects in method1() properly, no issue.
>
> But method2() has signature with input parameter as String, here it is
> giving me conversion error saying "no converter available to convert map to
> String".
> For solving this problem, I put the input param of method2() in map &
> passing this map onward.
>
> *Here unnecessarily I have to pass Map to all routes.*
>
> *Is it required that if I am passing an object of one type in sendBody() at
> the start of route then I have to continue with same object for rest of
> routes. *
>
> I tried for custom converter, but that have to register with camelcontext &
> get applied for all routes.
> How to solve this problem? Please help me.
> Can we have route specific converters? if yes then please tell me how can I
> use it.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/is-it-require-to-keep-datatype-of-inputParams-same-for-all-routes-tp5648290p5648290.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/