Have you looked at using .toD("bean:foo") where you can use the simple
language syntax within? For example, if you have a header named "beanId"
which has your bean name, then you could use .toD("bean:${header.beanId}").

On 7 August 2016 at 12:02, souciance <souciance.eqdam.ras...@gmail.com>
wrote:

> Don't have the  code near me,  but basically they are if the pattern:
>
> from()...
> processor()..
> to()..
>
> I want to replace the processor with a bean call e.g.
> bean({{"beanName/beanId"}}
>
> Each route instance needs to refer to a different bean hence the need to
> inject the bean name dynamically or via a property inside a header.
>
> Den 7 aug. 2016 6:26 em skrev "Ranx [via Camel]" <
> ml-node+s465427n5786123...@n5.nabble.com>:
>
> > What do the routes look like?
> >
> > On Sun, Aug 7, 2016 at 8:50 AM, souciance <[hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=5786123&i=0>>
> > wrote:
> >
> > > Hello,
> > >
> > > I am in the middle of refactoring several routes into a template route.
> > We
> > > have some beans in our blueprint xml (use to configure the camelcontext
> > -
> > > rest is java dsl) like this:
> > >
> > > <bean id="a1" class="com.home.MyA1Bean"/>
> > > <bean id="a2" class="com.home.MyA2Bean"/>
> > > <bean id="a3" class="com.home.MyA3Bean"/>
> > > <bean id="a4" class="com.home.MyA4Bean"/>
> > > <bean id="a5" class="com.home.MyA5Bean"/>
> > >
> > > The route references look similar to:
> > >   <bean id="route1" class="com.home.route">
> > >         <property........./>
> > >     </bean>
> > >   <bean id="route2" class="com.home.route">
> > >         <property........./>
> > >     </bean>
> > >   <bean id="route3" class="com.home.route">
> > >         <property........./>
> > >     </bean>
> > >   <bean id="route4" class="com.home.route">
> > >         <property........./>
> > >     </bean>
> > >   <bean id="route5" class="com.home.route">
> > >         <property........./>
> > >     </bean>
> > >
> > > Then in the camelcontext:
> > > <camelContext id="context" xmlns="http://camel.apache.
> > org/schema/blueprint
> > > ">
> > >         <routeBuilder ref="route1"/>
> > >         <routeBuilder ref="route2"/>
> > >         <routeBuilder ref="route3"/>
> > >         <routeBuilder ref="route4"/>
> > >         <routeBuilder ref="route5"/>
> > >     </camelContext>
> > >
> > > The problem I have is this. How can I dynamically inject bean with id
> > "a1"
> > > into the route instance "route1" bean with id "a2" into "route2" and so
> > on.
> > > Hardcoding the bean name or the class name would mean all the route
> > > instances share the same bean which is not what I want.
> > >
> > > Is it possible to create property who's value is the id of the bean and
> > > inject that property? Alternatively, are there headers where you can
> > inject
> > > the bean name? I have seen header for the method name but not the bean
> > > name.
> > >
> > > Hope it makes sense.
> > >
> > > Souciance
> > >
> > >
> > >
> > > --
> > > View this message in context: http://camel.465427.n5.nabble.
> > > com/Dynamic-bean-name-injection-tp5786108.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://camel.465427.n5.nabble.com/Dynamic-bean-name-
> > injection-tp5786108p5786123.html
> > To start a new topic under Camel - Users, email
> > ml-node+s465427n465428...@n5.nabble.com
> > To unsubscribe from Dynamic bean name injection, click here
> > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=
> unsubscribe_by_code&node=5786108&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpbC5jb218NTc4NjEwOHwxNTMyOTExNjU2>
> > .
> > NAML
> > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_
> viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.
> BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.view.web.template.NodeNamespace&breadcrumbs=
> notify_subscribers%21nabble%3Aemail.naml-instant_emails%
> 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Dynamic-bean-name-injection-tp5786108p5786126.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Matt Sicker <boa...@gmail.com>

Reply via email to