Hi,

I have a routetemplate as follows:

 routeTemplate("processortemplate")
         .templateParameter("out")
         .from("direct:in")
         .process("MyProcessor")
         .to("{{out}}");

This works.

The processor is registered an the called by reference. Now I added a
constructor argument to the processor and I tried to call it like this:

routeTemplate("processortemplate")
        .templateParameter("processerParam")
        .templateParameter("out")
        .from("direct:in")
        .process(new MyProcessor("{{processorParam}}"))
        .to("{{out}}");

This doesn't work, because the parameter of the processor is parsed before
the template parameter is parsed. Result is that the parameter
{{myProcessorParam}} is passed as literal param.

I tried to come with up something like this:

routeTemplate("processortemplate")
        .templateParameter("processerparam")
        .templateParameter("out")
        .templateBean("MyProcessor")
            .typeClass("com.foo.MyProcessor")
            .property("processerparam", "{{processerparam}}")
        .end()
        .from("direct:in")
        .to("bean:MyProcessor?method=process")
        .to("{{out}}");

But this didn't pass the parameter as well. As a workaround I set
constructor argument as a header and then get the header within the
processor.

Question:

Is there a way to pass constructor arguments to a processor in another way?
I couldn't find anything at the routeTemplate page on how to handle
processors.

Raymond

Reply via email to