You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sushil_vsk5 <su...@yahoo.co.in> on 2014/07/03 19:58:02 UTC
Spring DSL Type Converters
Hello:
I want to specify my type converters as Spring beans and refer to them
inside the application context file, something similar to what we can do for
Components rather than allowing Camel to auto-discover them. Is this
possible?
I need to do this as sometimes I am hitting a loading issue when running in
a JBoss 7 container (it does parallel loading of components) where a route
is loaded from Spring while the default type converters are still not
discovered. This ends up in the route failing to start up (no type converter
found from java.lang.String to java.lang.Integer, etc.)
However, this is intermittent and most of the time all start up fine and the
routes get initialized properly
Regards,
Sushil
--
View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-Type-Converters-tp5753300.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Spring DSL Type Converters
Posted by sushil_vsk5 <su...@yahoo.co.in>.
Hi:
Thanks for that.
Not sure if that would solve my specific problem though. If I have a route
with URI "jms://testQ?concurrentConsumers=3", then during initialization of
the route itself, type conversion kicks in to convert 3 from String to
Integer and fails if the default type converters are not yet loaded
Regards,
Sushil
--
View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-Type-Converters-tp5753300p5753459.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Spring DSL Type Converters
Posted by Willem Jiang <wi...@gmail.com>.
In most case we just grab the type converter from the camel context otherwise we need to know the converter class name. For you case if you register to converter to camel context even after the routes are initialised, the converter can still work.
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On July 7, 2014 at 2:37:48 AM, sushil_vsk5 (sushil_vsk5@yahoo.co.in) wrote:
> Hi:
>
> Thanks a lot for that.
>
> I was just wondering whether this solution would work in a fool-proof
> manner, concern being, I understand that the Camel Context cab be injected
> into a custom bean and then the type converters can be registered but
> wouldn't the routes still be initialized even before this custom bean
> initializes (assuming routes get initialized along with the Camel Context).
> In that case, I believe my original problem would still remain as I wont be
> able to guarantee that my custom bean initializes before the routes.
>
> Comments?
>
>
> Regards,
> Sushil
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-Type-Converters-tp5753300p5753427.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Spring DSL Type Converters
Posted by sushil_vsk5 <su...@yahoo.co.in>.
Hi:
Thanks a lot for that.
I was just wondering whether this solution would work in a fool-proof
manner, concern being, I understand that the Camel Context cab be injected
into a custom bean and then the type converters can be registered but
wouldn't the routes still be initialized even before this custom bean
initializes (assuming routes get initialized along with the Camel Context).
In that case, I believe my original problem would still remain as I wont be
able to guarantee that my custom bean initializes before the routes.
Comments?
Regards,
Sushil
--
View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-Type-Converters-tp5753300p5753427.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Spring DSL Type Converters
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Not currently. I think there is a JIRA ticket, to allow ppl to define
<bean> for type converters.
You can write a java bean that gets CamelContext injected, and then
you can use that to add the type converters manually.
On Thu, Jul 3, 2014 at 7:58 PM, sushil_vsk5 <su...@yahoo.co.in> wrote:
> Hello:
>
> I want to specify my type converters as Spring beans and refer to them
> inside the application context file, something similar to what we can do for
> Components rather than allowing Camel to auto-discover them. Is this
> possible?
>
> I need to do this as sometimes I am hitting a loading issue when running in
> a JBoss 7 container (it does parallel loading of components) where a route
> is loaded from Spring while the default type converters are still not
> discovered. This ends up in the route failing to start up (no type converter
> found from java.lang.String to java.lang.Integer, etc.)
>
> However, this is intermittent and most of the time all start up fine and the
> routes get initialized properly
>
> Regards,
> Sushil
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Spring-DSL-Type-Converters-tp5753300.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/