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 2010/01/03 17:12:40 UTC

Re: Routing to a method of an object with more than one parameters - part2

On Sun, Jan 3, 2010 at 4:15 PM, yaog <ya...@gmail.com> wrote:
>
> Hi,
>
> I fond a solution under:
>
> http://old.nabble.com/Routing-to-a-method-of-an-object-with-more-than-one-parameters-td15806637.html
>
> But I do not understand it.
>
> Does it mandate using a proxy? Can someone post a working spring example?
>

No a proxy is not needed.

Check out the bean binding documentation at
http://camel.apache.org/bean-binding.html

And if you have multiple parameters you can add annotations to bind to
those as well
http://camel.apache.org/parameter-binding-annotations.html

Binding parameters to a bean is done in Java code so its not really
special for Spring vs. non Spring examples.


And there is a complete chapter 4 in this book which talks about using
beans with Camel
http://www.manning.com/ibsen/



> Thanks.
> --
> View this message in context: http://old.nabble.com/Routing-to-a-method-of-an-object-with-more-than-one-parameters---part2-tp27002285p27002285.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Routing to a method of an object with more than one parameters - part2

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 4, 2010 at 8:43 AM, yaog <ya...@gmail.com> wrote:
>
> Thanks.
>
> I have read those links, but... It may be me, but I cannot understand how it
> all hooks up.
>
> What I want to define is a bean that is invoked with a method that gets 3
> parameters.
>
> Scenario is one of the following 2:
>
> 1. Bean a class bean B ant wants to pass 3 parameters and not just one. This
> involves existing interfaces so sending an Object Array is not applicable.
>

You can use a Camel Processor to extract those 3 parameters from the
Camel Exchange and invoke the bean yourself.



> 2. Using a "fork" - a bean should be invoked once receiving message from 3
> different queues. The bean method should be invoked once with the 3
> different objects from the 3 queues sent to it's 3 param method.
>

Hmmm so the bean should first be invoked *after* there are 3 messages
in total, from 3 queues?
Should you wait forever until there are 3 messages, or do you need to
timeout or what?

You can use a Polling Consumer to consume from those 3 queues?
http://camel.apache.org/polling-consumer.html

And then invoke that bean yourself with those 3 parameters.


> I just can't understand where and how I "hook" my custom code to do the
> magic.
>
> Please advise. Example would be great.
>
> Thanks.
> --
> View this message in context: http://old.nabble.com/Routing-to-a-method-of-an-object-with-more-than-one-parameters---part2-tp27002285p27009702.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Routing to a method of an object with more than one parameters - part2

Posted by yaog <ya...@gmail.com>.
Thanks.

I have read those links, but... It may be me, but I cannot understand how it
all hooks up.

What I want to define is a bean that is invoked with a method that gets 3
parameters.

Scenario is one of the following 2:

1. Bean a class bean B ant wants to pass 3 parameters and not just one. This
involves existing interfaces so sending an Object Array is not applicable.

2. Using a "fork" - a bean should be invoked once receiving message from 3
different queues. The bean method should be invoked once with the 3
different objects from the 3 queues sent to it's 3 param method.

I just can't understand where and how I "hook" my custom code to do the
magic.

Please advise. Example would be great.

Thanks.
-- 
View this message in context: http://old.nabble.com/Routing-to-a-method-of-an-object-with-more-than-one-parameters---part2-tp27002285p27009702.html
Sent from the Camel - Users mailing list archive at Nabble.com.