Which Bean binding rule does Camel use for this Bean ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Which Bean binding rule does Camel use for this Bean ?

Sreyan Chakravarty
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
Reply | Threaded
Open this post in threaded view
|

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

Claus Ibsen-2
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
<[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

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

Sreyan Chakravarty
Thanks.

On Sat, Dec 7, 2019 at 8:56 PM Claus Ibsen <[hidden email]> 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
> <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

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

Sreyan Chakravarty
In reply to this post by Claus Ibsen-2
What do you mean by CiA1 or 2 book ?

Camel in Action ?

On Sat, Dec 7, 2019 at 8:56 PM Claus Ibsen <[hidden email]> 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
> <[hidden email]> 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