You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/06/09 09:51:02 UTC

@Handler, @Body, @Header : question

Hi,

If we add the following annotation @Handler to our method, can we continue
to use annotations like @Header, @Body as parameters ?

Example

public class Bar {

    @Handler
    public String doSomething(@Header(name = "user") String user,
@Body String body, Exchange exchange) {
      // process the in body and return whatever you want
      return "Bye World";
   }


Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com

Re: @Handler, @Body, @Header : question

Posted by Charles Moulliard <cm...@gmail.com>.
I was using camel 2.0-M1 where this annotation does not exist. I have
switched to 2.0-SNAPSHOT.

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Tue, Jun 9, 2009 at 10:34 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Jun 9, 2009 at 10:22 AM, Charles Moulliard<cm...@gmail.com>
> wrote:
> > In which package is defined this annotation (@handler) ?
> >
> > What will happen if we have several @handler defined in a class ?
> They have different package (namespace) so its just like having two
> classes such as Message.
> You can use the fully qualified classname.
>
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
> >
> > On Tue, Jun 9, 2009 at 10:13 AM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> On Tue, Jun 9, 2009 at 9:51 AM, Charles Moulliard<cm...@gmail.com>
> >> wrote:
> >> > Hi,
> >> >
> >> > If we add the following annotation @Handler to our method, can we
> >> continue
> >> > to use annotations like @Header, @Body as parameters ?
> >> Yes. @Handler is just a hint to Camel that it should prefer to use
> >> this one over any other methods.
> >>
> >> >
> >> > Example
> >> >
> >> > public class Bar {
> >> >
> >> >    @Handler
> >> >    public String doSomething(@Header(name = "user") String user,
> >> > @Body String body, Exchange exchange) {
> >> >      // process the in body and return whatever you want
> >> >      return "Bye World";
> >> >   }
> >> >
> >> >
> >> > Regards,
> >> >
> >> > Charles Moulliard
> >> > Senior Enterprise Architect
> >> > Apache Camel Committer
> >> >
> >> > *****************************
> >> > blog : http://cmoulliard.blogspot.com
> >> >
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> Apache Camel Committer
> >>
> >> Open Source Integration: http://fusesource.com
> >> Blog: http://davsclaus.blogspot.com/
> >> Twitter: http://twitter.com/davsclaus
> >>
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: @Handler, @Body, @Header : question

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jun 9, 2009 at 10:22 AM, Charles Moulliard<cm...@gmail.com> wrote:
> In which package is defined this annotation (@handler) ?
>
> What will happen if we have several @handler defined in a class ?
They have different package (namespace) so its just like having two
classes such as Message.
You can use the fully qualified classname.

>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Tue, Jun 9, 2009 at 10:13 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Tue, Jun 9, 2009 at 9:51 AM, Charles Moulliard<cm...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > If we add the following annotation @Handler to our method, can we
>> continue
>> > to use annotations like @Header, @Body as parameters ?
>> Yes. @Handler is just a hint to Camel that it should prefer to use
>> this one over any other methods.
>>
>> >
>> > Example
>> >
>> > public class Bar {
>> >
>> >    @Handler
>> >    public String doSomething(@Header(name = "user") String user,
>> > @Body String body, Exchange exchange) {
>> >      // process the in body and return whatever you want
>> >      return "Bye World";
>> >   }
>> >
>> >
>> > Regards,
>> >
>> > Charles Moulliard
>> > Senior Enterprise Architect
>> > Apache Camel Committer
>> >
>> > *****************************
>> > blog : http://cmoulliard.blogspot.com
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: @Handler, @Body, @Header : question

Posted by Charles Moulliard <cm...@gmail.com>.
In which package is defined this annotation (@handler) ?

What will happen if we have several @handler defined in a class ?

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Tue, Jun 9, 2009 at 10:13 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Jun 9, 2009 at 9:51 AM, Charles Moulliard<cm...@gmail.com>
> wrote:
> > Hi,
> >
> > If we add the following annotation @Handler to our method, can we
> continue
> > to use annotations like @Header, @Body as parameters ?
> Yes. @Handler is just a hint to Camel that it should prefer to use
> this one over any other methods.
>
> >
> > Example
> >
> > public class Bar {
> >
> >    @Handler
> >    public String doSomething(@Header(name = "user") String user,
> > @Body String body, Exchange exchange) {
> >      // process the in body and return whatever you want
> >      return "Bye World";
> >   }
> >
> >
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: @Handler, @Body, @Header : question

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jun 9, 2009 at 9:51 AM, Charles Moulliard<cm...@gmail.com> wrote:
> Hi,
>
> If we add the following annotation @Handler to our method, can we continue
> to use annotations like @Header, @Body as parameters ?
Yes. @Handler is just a hint to Camel that it should prefer to use
this one over any other methods.

>
> Example
>
> public class Bar {
>
>    @Handler
>    public String doSomething(@Header(name = "user") String user,
> @Body String body, Exchange exchange) {
>      // process the in body and return whatever you want
>      return "Bye World";
>   }
>
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus