You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2009/10/03 07:52:16 UTC

Re: using methodName for bean binding doesn't work with Processor beans

Hi

Use <processRef ref="foo"/>

To invoke the Processor which then will invoke the process(Exchange) method.


On Fri, Oct 2, 2009 at 6:01 PM, erh <EH...@transunion.com> wrote:
>
> I'm having trouble getting the methodName to work when routing to a bean
> using a route like this:
> <route>
>   <from uri="some_endpoint"/>
>   <to uri="bean:foo?methodName=myfunc"/> <!-- [*1] -->
> </route>
>
> foo is a bean that implements Processor [*2], and in some routes I want it
> to use the process() method, but in this case I need to use a different
> entry point.  According to http://camel.apache.org/bean-binding.html , use
> of methodName is supposed to take precedence.
> So, is this a bug in the code, or is the documentation wrong?
>
> As a way to work around this issue in my code, is it possible to retrieve
> that methodName parameter from the Exchange object?  I was hoping it would
> show up as a property, but calling x.getProperty("methodName") returns null.
>
> I'm using Camel 1.6.2-SNAPSHOT as of 2009/08/12.
>
> eric
>
> [*1]
> I also tried "bean:foo/myfunc" as the uri, but that complained about "No
> bean available for endpoint: foo/myfunc" even though
> http://camel.apache.org/pojo-consuming.html claims it should work.
>
> [*2] Example Foo class:
> package com.tuc;
> import org.apache.log4j.*;
> import org.apache.camel.*;
> public class Foo
>   implements Processor // comment out this line and it works fine.
> {
>    private static final Logger log = Logger.getLogger(Foo.class);
>    public Object myfunc() { log.error("should end up here"); return "foo";
> }
>    public void process(Exchange x) { log.error("in process instead"); }
> }
>
> --
> View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25716723.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus