camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minh Tran <>
Subject Re: Some Stupid Questions
Date Sun, 02 Aug 2015 22:01:43 GMT

On 02/08/2015, at 10:05 PM, Felix Thomas <> wrote:

> Hello,
>    I had some doubts so I thought the forum is the best way to get some
> answers.
>  1) Since I am using XML DSL earlier Java DSL.
>    I have a Bean defined like below. Currently the Constructor is passed.
> But How do I make it dynamic i.e. decide based on the route which argument
> to pass. Do I need to make always different bean entry for each argument to
> pass.
>   <bean id="CustomProcessorDB"
> class="com.worldline.frida.camel.core.CustomProcessor">
>     <constructor-arg value="DB"/>
>   </bean>
> In java I could write  process(new CustomProcessor(CustomConstants.CSV))
> Can I do the same in XML.

You can refactor your processor so instead of taking the argument on construction, you can
have a method that takes that argument. Then simply pass this argument using a header inside
camel. If you do not wish to or cannot change your existing code, you could always implement
a factory to return the correct processor.

View raw message