You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sreyan Chakravarty <sr...@gmail.com> on 2019/12/07 12:20:42 UTC

Which Bean binding rule does Camel use for this Bean ?

I am just starting out with Camel and saw a good youtube video(
https://youtu.be/91UiQgazt3g?t=1859) on it from where this example baffled
me.

Given the following Java Bean:

@Singleton
public class SomeBean {

      private int counter;
      public int someMethod() {
      return "Hello" + ++counter;
      }
}

I have seen camel code calling the method of the bean like following:

from(inputEndpoint).
       setHeader("Header", method(someBean)


*Notice that the method is not specified yet Camel can make out what method
to invoke. How does it do that ?*

Which of the bean binding(
https://camel.apache.org/manual/latest/bean-binding.html#BeanBinding-Choosingthemethodtoinvoke)
r*ules does Camel use in this case ?*


-- 
Regards,
Sreyan

Re: Which Bean binding rule does Camel use for this Bean ?

Posted by Sreyan Chakravarty <sr...@gmail.com>.
What do you mean by CiA1 or 2 book ?

Camel in Action ?

On Sat, Dec 7, 2019 at 8:56 PM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> If you have the CiA1 or 2 book then the algorithm is covered there in
> much details.
>
> But you also provided a link to the docs that kinda explains it.
> The bean has 1 public method so it will be used.
>
>
> On Sat, Dec 7, 2019 at 1:21 PM Sreyan Chakravarty
> <sr...@gmail.com> wrote:
> >
> > I am just starting out with Camel and saw a good youtube video(
> > https://youtu.be/91UiQgazt3g?t=1859) on it from where this example
> baffled
> > me.
> >
> > Given the following Java Bean:
> >
> > @Singleton
> > public class SomeBean {
> >
> >       private int counter;
> >       public int someMethod() {
> >       return "Hello" + ++counter;
> >       }
> > }
> >
> > I have seen camel code calling the method of the bean like following:
> >
> > from(inputEndpoint).
> >        setHeader("Header", method(someBean)
> >
> >
> > *Notice that the method is not specified yet Camel can make out what
> method
> > to invoke. How does it do that ?*
> >
> > Which of the bean binding(
> >
> https://camel.apache.org/manual/latest/bean-binding.html#BeanBinding-Choosingthemethodtoinvoke
> )
> > r*ules does Camel use in this case ?*
> >
> >
> > --
> > Regards,
> > Sreyan
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Regards,
Sreyan

Re: Which Bean binding rule does Camel use for this Bean ?

Posted by Sreyan Chakravarty <sr...@gmail.com>.
Thanks.

On Sat, Dec 7, 2019 at 8:56 PM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> If you have the CiA1 or 2 book then the algorithm is covered there in
> much details.
>
> But you also provided a link to the docs that kinda explains it.
> The bean has 1 public method so it will be used.
>
>
> On Sat, Dec 7, 2019 at 1:21 PM Sreyan Chakravarty
> <sr...@gmail.com> wrote:
> >
> > I am just starting out with Camel and saw a good youtube video(
> > https://youtu.be/91UiQgazt3g?t=1859) on it from where this example
> baffled
> > me.
> >
> > Given the following Java Bean:
> >
> > @Singleton
> > public class SomeBean {
> >
> >       private int counter;
> >       public int someMethod() {
> >       return "Hello" + ++counter;
> >       }
> > }
> >
> > I have seen camel code calling the method of the bean like following:
> >
> > from(inputEndpoint).
> >        setHeader("Header", method(someBean)
> >
> >
> > *Notice that the method is not specified yet Camel can make out what
> method
> > to invoke. How does it do that ?*
> >
> > Which of the bean binding(
> >
> https://camel.apache.org/manual/latest/bean-binding.html#BeanBinding-Choosingthemethodtoinvoke
> )
> > r*ules does Camel use in this case ?*
> >
> >
> > --
> > Regards,
> > Sreyan
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Regards,
Sreyan

Re: Which Bean binding rule does Camel use for this Bean ?

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

If you have the CiA1 or 2 book then the algorithm is covered there in
much details.

But you also provided a link to the docs that kinda explains it.
The bean has 1 public method so it will be used.


On Sat, Dec 7, 2019 at 1:21 PM Sreyan Chakravarty
<sr...@gmail.com> wrote:
>
> I am just starting out with Camel and saw a good youtube video(
> https://youtu.be/91UiQgazt3g?t=1859) on it from where this example baffled
> me.
>
> Given the following Java Bean:
>
> @Singleton
> public class SomeBean {
>
>       private int counter;
>       public int someMethod() {
>       return "Hello" + ++counter;
>       }
> }
>
> I have seen camel code calling the method of the bean like following:
>
> from(inputEndpoint).
>        setHeader("Header", method(someBean)
>
>
> *Notice that the method is not specified yet Camel can make out what method
> to invoke. How does it do that ?*
>
> Which of the bean binding(
> https://camel.apache.org/manual/latest/bean-binding.html#BeanBinding-Choosingthemethodtoinvoke)
> r*ules does Camel use in this case ?*
>
>
> --
> Regards,
> Sreyan



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2