On Sun, Jul 7, 2019 at 6:58 PM Richard Flores <[email protected]> wrote:
>
> Sorry. I still don’t quite understand. After looking through the user guide 
> again and doing some searches it seems like this annotation provides support 
> for Bean Binding. So I guess I should be asking: what is bean binding and 
> what are the use cases?
>

Continue read the docs
http://camel.apache.org/bean-binding.html

Also for an in-depth and better coverage of Camel, then there are
books such as Camel in Action 2nd as the latest


> > On Jul 7, 2019, at 11:31 AM, Claus Ibsen <[email protected]> wrote:
> >
> > Hi
> >
> > No its not the same @Handler is NOT for consuming.
> >
> > Its like
> >
> >   from file
> >     to bean
> >     to file
> >
> > And then you have a bean with some methods, and then to tell Camel
> > that is should use a specific method then you can add @Handler.
> >
> >
> > On Sun, Jul 7, 2019 at 6:14 PM Richard Flores <[email protected] 
> > <mailto:[email protected]>> wrote:
> >>
> >> This is confusing:
> >>
> >>        “You can use @Handler when you have a POJO with N+ methods….such as 
> >> when you send a message to the bean endpoint, or use 
> >> bean(MyBeanClass.class) in the route”
> >>
> >> This is effectively doing the same thing as a bean with @Consume 
> >> annotation, no? Why are there seemingly two ways of doing the same thing? 
> >> In the context of a Spring Boot/Camel/ActiveMQ what am I missing?
> >>
> >> Any info is appreciated!
> >>
> >>
> >>> On Jul 7, 2019, at 10:05 AM, Claus Ibsen <[email protected]> wrote:
> >>>
> >>> Hi
> >>>
> >>> @Handler is not related to ConsumerTemplate.
> >>>
> >>> You can use @Handler when you have a POJO with N+ methods, and you
> >>> just want to tell Camel that it should always use this method when
> >>> Camel is using this bean, such as when you send a message to the bean
> >>> endpoint, or use bean(MyBeanClass.class) in the route etc.
> >>>
> >>> On the other hand @Consume is an annotation you can use on a bean to
> >>> let Camel use the method as consumer, and this is more related to
> >>> consumer template. Then you can do POJO messaging, eg if you use
> >>> Spring Boot you can do this on beans you let Spring Boot manage.
> >>>
> >>> https://github.com/apache/camel/tree/master/examples/camel-example-pojo-messaging
> >>>  
> >>> <https://github.com/apache/camel/tree/master/examples/camel-example-pojo-messaging>
> >>>  
> >>> <https://github.com/apache/camel/tree/master/examples/camel-example-pojo-messaging
> >>>  
> >>> <https://github.com/apache/camel/tree/master/examples/camel-example-pojo-messaging>>
> >>>
> >>> On Sun, Jul 7, 2019 at 4:48 PM Richard Flores <[email protected] 
> >>> <mailto:[email protected]> <mailto:[email protected] 
> >>> <mailto:[email protected]>>> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> I’m new to Camel, trying to get my head wrapped around conventions and 
> >>>> usages and get some samples going. I’m trying to understand what is the 
> >>>> difference between Consumer Templates and the @Handler Annotation.
> >>>>
> >>>> According to http://camel.apache.org/manual/camel-manual-2.3.0.html 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html> 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html>> 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html> 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html 
> >>>> <http://camel.apache.org/manual/camel-manual-2.3.0.html>>>
> >>>>
> >>>>       @Handler
> >>>>
> >>>>       Available as of Camel 2.0
> >>>>
> >>>>       You can mark a method in your bean with the @Handler annotation to 
> >>>> indicate that this method should be used for Bean Binding.
> >>>>       This has the advantage as you do not have to specify the method 
> >>>> name in the Camel route. And thus you do not run into problems when you 
> >>>> rename the method name using an IDE that don't find all references.
> >>>>
> >>>>       public class Bar {
> >>>>
> >>>>               @Handler
> >>>>               public String doSomething(Stringbody) {
> >>>>                       // process the in body and return whatever you want
> >>>>                       return "Bye World";
> >>>>       }
> >>>>
> >>>> Given a bean with configured routes and a producer template, I get the 
> >>>> impression that you could use a bean with a method annotated with 
> >>>> @Handler in lieu of a bean with a regular method that uses a consumer 
> >>>> template.
> >>>>
> >>>> Is this correct? What am I missing?
> >>>>
> >>>> Also, I’m planning on using Spring Boot with Spring for Apache ActiveMQ 
> >>>> and Apache Camel, do the producer/consumer, handler concepts change?
> >>>>
> >>>> Thanks!
> >>>
> >>>
> >>>
> >>> --
> >>> Claus Ibsen
> >>> -----------------
> >>> http://davsclaus.com <http://davsclaus.com/> <http://davsclaus.com/ 
> >>> <http://davsclaus.com/>> @davsclaus
> >>> Camel in Action 2: https://www.manning.com/ibsen2 
> >>> <https://www.manning.com/ibsen2> <https://www.manning.com/ibsen2 
> >>> <https://www.manning.com/ibsen2>>
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com <http://davsclaus.com/> @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2 
> > <https://www.manning.com/ibsen2>



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

Reply via email to