camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Attributes from RouteBuilder as beans in route
Date Fri, 06 Jul 2012 14:22:45 GMT
Hi

Make sure to set the params attribue before Camel is starting, so its != null

On Fri, Jul 6, 2012 at 4:04 PM, Hilde <hilde.schwed@yahoo.de> wrote:
> Hello!
>
> We use the Java DSL to model Camel Routes.
> The RouteBuilder class that we use for this very Route has an attribute and
> we would like to use this
> attribute as a bean inside the Route.
>
> Here is the code snippet:
>
> public class CreateScriptRoute extends RouteBuilder {
> ...
> private ScriptParams params;
>
>         @Override
>         public void configure() throws Exception {
>                 from("direct:createScriptTransformDBInit")
>                                 .routeId("createScriptTransformDBInit")
>                                 .bean(params) // that fails!!!
>                                 .choice()
>
> ...
>
> }
>
> However when I try I get the following error:
>
> Caused by: java.lang.IllegalArgumentException: bean, ref or beanType must be
> provided
>         at
> org.apache.camel.model.BeanDefinition.createProcessor(BeanDefinition.java:202)
>         at
> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:441)
>         at
> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179)
>
> Is there a way to use the attribute in the bean section of the Route anyway?
> I need that instance
> because it is injected especially for testing.
>
> Cheers
> Hilde
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Attributes-from-RouteBuilder-as-beans-in-route-tp5715628.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message