On 02/08/2015, at 10:05 PM, Felix Thomas <[email protected]> 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.

Reply via email to