You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by erh <EH...@transunion.com> on 2009/10/02 18:01:59 UTC

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

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.


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

Posted by erh <EH...@transunion.com>.


Claus Ibsen-2 wrote:
> 
> Hi
> 
> I have just backported a fix for CAMEL-1878 to 1.x as well.
> You are welcome to try with a new 1.6.2-SNAPSHOT whether it fixes your
> bean problem.
> 
> 

Thanks!  I'll give it a shot.

eric
-- 
View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25744973.html
Sent from the Camel - Users mailing list archive at Nabble.com.


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

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Oct 8, 2009 at 5:51 PM, erh <EH...@transunion.com> wrote:
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Thanks I can see its the new OSGi blueprint support that causes some
>> maven issues.
>> Will disable this until blueprint works completely.
>>
>
> Well, the build worked, but some tests failed, and I guess that means the
> tarball didn't get over to repository.apache.org.  :(
> I didn't see an obvious way to grab the overall tarball directly from
> hudson, but I tried cherry picking the jar files that I needed and was able
> to get my methodName test to work.  Thanks for getting that fix in.

Great that is good news.


>
> eric
> --
> View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25803269.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

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

Posted by erh <EH...@transunion.com>.


Claus Ibsen-2 wrote:
> 
> Thanks I can see its the new OSGi blueprint support that causes some
> maven issues.
> Will disable this until blueprint works completely.
> 

Well, the build worked, but some tests failed, and I guess that means the
tarball didn't get over to repository.apache.org.  :(
I didn't see an obvious way to grab the overall tarball directly from
hudson, but I tried cherry picking the jar files that I needed and was able
to get my methodName test to work.  Thanks for getting that fix in.

eric
-- 
View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25803269.html
Sent from the Camel - Users mailing list archive at Nabble.com.


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

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Oct 7, 2009 at 7:44 PM, erh <EH...@transunion.com> wrote:
>
>
> Claus Ibsen-2 wrote:
>>
>> On Mon, Oct 5, 2009 at 7:32 PM, erh <EH...@transunion.com> wrote:
>>> Do the snapshots get built automatically?  The dates on the files in the
>>> 1.6.2-SNAPSHOT directory are a bit odd.  The md5 and sha1 files have a
>>> timestamp from October 4th, but the tarballs are from September 29th and
>>> 16th.  Shouldn't the timestamps on these files be much closer together?
>>>
>>
>> You can not trust the dates on the folders etc. Its the Apache
>> infrastructure that uses Hudson that deploys those builds.
>> The actual -SNAPSHOT file however doe have correct timestamps.
>>
>> The real releases however should have correct timestamps for all
>> artifacts and folders.
>>
>
> hmm.. that seems very odd that it updates the md5 files all the time.  Well
> anyway, I don't care much about that right now.  More importantly, according
> to http://hudson.zones.apache.org/hudson/view/Camel/job/Camel-1.x/ it looks
> the camel-1.x builds are failing, so nothing is getting over to the
> repository.apache.org site.
>
> It looks like the most recent complaint is that it can't find the class
> com/sun/mirror/apt/AnnotationProcessorFactory
>

Thanks I can see its the new OSGi blueprint support that causes some
maven issues.
Will disable this until blueprint works completely.


> eric
> --
> View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25791218.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

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

Posted by erh <EH...@transunion.com>.

Claus Ibsen-2 wrote:
> 
> On Mon, Oct 5, 2009 at 7:32 PM, erh <EH...@transunion.com> wrote:
>> Do the snapshots get built automatically?  The dates on the files in the
>> 1.6.2-SNAPSHOT directory are a bit odd.  The md5 and sha1 files have a
>> timestamp from October 4th, but the tarballs are from September 29th and
>> 16th.  Shouldn't the timestamps on these files be much closer together?
>>
> 
> You can not trust the dates on the folders etc. Its the Apache
> infrastructure that uses Hudson that deploys those builds.
> The actual -SNAPSHOT file however doe have correct timestamps.
> 
> The real releases however should have correct timestamps for all
> artifacts and folders.
> 

hmm.. that seems very odd that it updates the md5 files all the time.  Well
anyway, I don't care much about that right now.  More importantly, according
to http://hudson.zones.apache.org/hudson/view/Camel/job/Camel-1.x/ it looks
the camel-1.x builds are failing, so nothing is getting over to the
repository.apache.org site.

It looks like the most recent complaint is that it can't find the class
com/sun/mirror/apt/AnnotationProcessorFactory

eric
-- 
View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25791218.html
Sent from the Camel - Users mailing list archive at Nabble.com.


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

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Oct 5, 2009 at 7:32 PM, erh <EH...@transunion.com> wrote:
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> I have just backported a fix for CAMEL-1878 to 1.x as well.
>> You are welcome to try with a new 1.6.2-SNAPSHOT whether it fixes your
>> bean problem.
>>
>>
>
> Do the snapshots get built automatically?  The dates on the files in the
> 1.6.2-SNAPSHOT directory are a bit odd.  The md5 and sha1 files have a
> timestamp from October 4th, but the tarballs are from September 29th and
> 16th.  Shouldn't the timestamps on these files be much closer together?
>

You can not trust the dates on the folders etc. Its the Apache
infrastructure that uses Hudson that deploys those builds.
The actual -SNAPSHOT file however doe have correct timestamps.

The real releases however should have correct timestamps for all
artifacts and folders.


> eric
> --
> View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25754739.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

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

Posted by erh <EH...@transunion.com>.


Claus Ibsen-2 wrote:
> 
> Hi
> 
> I have just backported a fix for CAMEL-1878 to 1.x as well.
> You are welcome to try with a new 1.6.2-SNAPSHOT whether it fixes your
> bean problem.
> 
> 

Do the snapshots get built automatically?  The dates on the files in the
1.6.2-SNAPSHOT directory are a bit odd.  The md5 and sha1 files have a
timestamp from October 4th, but the tarballs are from September 29th and
16th.  Shouldn't the timestamps on these files be much closer together?

eric
-- 
View this message in context: http://www.nabble.com/using-methodName-for-bean-binding-doesn%27t-work-with-Processor-beans-tp25716723p25754739.html
Sent from the Camel - Users mailing list archive at Nabble.com.


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

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have just backported a fix for CAMEL-1878 to 1.x as well.
You are welcome to try with a new 1.6.2-SNAPSHOT whether it fixes your
bean problem.


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

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

Posted by Claus Ibsen <cl...@gmail.com>.
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