You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tarun Kumar <ag...@gmail.com> on 2013/07/02 07:50:55 UTC

Is onFinally() compulsory after doCatch()?

my route looks like this:

from().
.toTry().process()
.doCatch(Exception.class)
.to().to().process()
.end()


My questions are:

1. is .doFinally compulsory after doCatch()?
2. In my case, how does route know whether second .to() in line 4 is inside
doCatch() or after doCatch()?
3. I am using cxfrs component, why is my exchange body not being returned
back to caller. Caller is seeing 204 no content found. While, when i remove
doTry and doCatch() with same code, caller is able to see proper response
(exchange body, status and all). Why is that?

Re: Is onFinally() compulsory after doCatch()?

Posted by Claus Ibsen <cl...@gmail.com>.
Good idea, I updated the doc page with a tip about the end.

On Wed, Jul 3, 2013 at 6:01 AM, Tarun Kumar <ag...@gmail.com> wrote:
> Thanks Claus. This is not mentioned in
> http://camel.apache.org/try-catch-finally.html. I think it will be great if
> this can be added to that page. It will really help beginners like me.
>
>
> On Tue, Jul 2, 2013 at 11:46 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> The end() marks when doCatch ends. So all the stuff in between is
>> inside the doCatch.
>>
>>
>>
>> On Tue, Jul 2, 2013 at 12:36 PM, Tarun Kumar <ag...@gmail.com>
>> wrote:
>> > Above link doesn't answer my second ques. Could you please help?
>> >
>> >
>> > On Tue, Jul 2, 2013 at 12:41 PM, Christian Müller <
>> > christian.mueller@gmail.com> wrote:
>> >
>> >> Check out the link I already sent to you [1].
>> >>
>> >> [1] http://camel.apache.org/try-catch-finally.html
>> >>
>> >> Best,
>> >> Christian
>> >> -----------------
>> >>
>> >> Software Integration Specialist
>> >>
>> >> Apache Camel committer: https://camel.apache.org/team
>> >> V.P. Apache Camel: https://www.apache.org/foundation/
>> >> Apache Member: https://www.apache.org/foundation/members.html
>> >>
>> >> https://www.linkedin.com/pub/christian-mueller/11/551/642
>> >>
>> >>
>> >> On Tue, Jul 2, 2013 at 7:50 AM, Tarun Kumar <agrawal.tarun23@gmail.com
>> >> >wrote:
>> >>
>> >> > my route looks like this:
>> >> >
>> >> > from().
>> >> > .toTry().process()
>> >> > .doCatch(Exception.class)
>> >> > .to().to().process()
>> >> > .end()
>> >> >
>> >> >
>> >> > My questions are:
>> >> >
>> >> > 1. is .doFinally compulsory after doCatch()?
>> >> > 2. In my case, how does route know whether second .to() in line 4 is
>> >> inside
>> >> > doCatch() or after doCatch()?
>> >> > 3. I am using cxfrs component, why is my exchange body not being
>> returned
>> >> > back to caller. Caller is seeing 204 no content found. While, when i
>> >> remove
>> >> > doTry and doCatch() with same code, caller is able to see proper
>> response
>> >> > (exchange body, status and all). Why is that?
>> >> >
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> www.camelone.org: The open source integration conference.
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: cibsen@redhat.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Is onFinally() compulsory after doCatch()?

Posted by Tarun Kumar <ag...@gmail.com>.
Thanks Claus. This is not mentioned in
http://camel.apache.org/try-catch-finally.html. I think it will be great if
this can be added to that page. It will really help beginners like me.


On Tue, Jul 2, 2013 at 11:46 PM, Claus Ibsen <cl...@gmail.com> wrote:

> The end() marks when doCatch ends. So all the stuff in between is
> inside the doCatch.
>
>
>
> On Tue, Jul 2, 2013 at 12:36 PM, Tarun Kumar <ag...@gmail.com>
> wrote:
> > Above link doesn't answer my second ques. Could you please help?
> >
> >
> > On Tue, Jul 2, 2013 at 12:41 PM, Christian Müller <
> > christian.mueller@gmail.com> wrote:
> >
> >> Check out the link I already sent to you [1].
> >>
> >> [1] http://camel.apache.org/try-catch-finally.html
> >>
> >> Best,
> >> Christian
> >> -----------------
> >>
> >> Software Integration Specialist
> >>
> >> Apache Camel committer: https://camel.apache.org/team
> >> V.P. Apache Camel: https://www.apache.org/foundation/
> >> Apache Member: https://www.apache.org/foundation/members.html
> >>
> >> https://www.linkedin.com/pub/christian-mueller/11/551/642
> >>
> >>
> >> On Tue, Jul 2, 2013 at 7:50 AM, Tarun Kumar <agrawal.tarun23@gmail.com
> >> >wrote:
> >>
> >> > my route looks like this:
> >> >
> >> > from().
> >> > .toTry().process()
> >> > .doCatch(Exception.class)
> >> > .to().to().process()
> >> > .end()
> >> >
> >> >
> >> > My questions are:
> >> >
> >> > 1. is .doFinally compulsory after doCatch()?
> >> > 2. In my case, how does route know whether second .to() in line 4 is
> >> inside
> >> > doCatch() or after doCatch()?
> >> > 3. I am using cxfrs component, why is my exchange body not being
> returned
> >> > back to caller. Caller is seeing 204 no content found. While, when i
> >> remove
> >> > doTry and doCatch() with same code, caller is able to see proper
> response
> >> > (exchange body, status and all). Why is that?
> >> >
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> www.camelone.org: The open source integration conference.
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Re: Is onFinally() compulsory after doCatch()?

Posted by Claus Ibsen <cl...@gmail.com>.
The end() marks when doCatch ends. So all the stuff in between is
inside the doCatch.



On Tue, Jul 2, 2013 at 12:36 PM, Tarun Kumar <ag...@gmail.com> wrote:
> Above link doesn't answer my second ques. Could you please help?
>
>
> On Tue, Jul 2, 2013 at 12:41 PM, Christian Müller <
> christian.mueller@gmail.com> wrote:
>
>> Check out the link I already sent to you [1].
>>
>> [1] http://camel.apache.org/try-catch-finally.html
>>
>> Best,
>> Christian
>> -----------------
>>
>> Software Integration Specialist
>>
>> Apache Camel committer: https://camel.apache.org/team
>> V.P. Apache Camel: https://www.apache.org/foundation/
>> Apache Member: https://www.apache.org/foundation/members.html
>>
>> https://www.linkedin.com/pub/christian-mueller/11/551/642
>>
>>
>> On Tue, Jul 2, 2013 at 7:50 AM, Tarun Kumar <agrawal.tarun23@gmail.com
>> >wrote:
>>
>> > my route looks like this:
>> >
>> > from().
>> > .toTry().process()
>> > .doCatch(Exception.class)
>> > .to().to().process()
>> > .end()
>> >
>> >
>> > My questions are:
>> >
>> > 1. is .doFinally compulsory after doCatch()?
>> > 2. In my case, how does route know whether second .to() in line 4 is
>> inside
>> > doCatch() or after doCatch()?
>> > 3. I am using cxfrs component, why is my exchange body not being returned
>> > back to caller. Caller is seeing 204 no content found. While, when i
>> remove
>> > doTry and doCatch() with same code, caller is able to see proper response
>> > (exchange body, status and all). Why is that?
>> >
>>



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Is onFinally() compulsory after doCatch()?

Posted by Tarun Kumar <ag...@gmail.com>.
Above link doesn't answer my second ques. Could you please help?


On Tue, Jul 2, 2013 at 12:41 PM, Christian Müller <
christian.mueller@gmail.com> wrote:

> Check out the link I already sent to you [1].
>
> [1] http://camel.apache.org/try-catch-finally.html
>
> Best,
> Christian
> -----------------
>
> Software Integration Specialist
>
> Apache Camel committer: https://camel.apache.org/team
> V.P. Apache Camel: https://www.apache.org/foundation/
> Apache Member: https://www.apache.org/foundation/members.html
>
> https://www.linkedin.com/pub/christian-mueller/11/551/642
>
>
> On Tue, Jul 2, 2013 at 7:50 AM, Tarun Kumar <agrawal.tarun23@gmail.com
> >wrote:
>
> > my route looks like this:
> >
> > from().
> > .toTry().process()
> > .doCatch(Exception.class)
> > .to().to().process()
> > .end()
> >
> >
> > My questions are:
> >
> > 1. is .doFinally compulsory after doCatch()?
> > 2. In my case, how does route know whether second .to() in line 4 is
> inside
> > doCatch() or after doCatch()?
> > 3. I am using cxfrs component, why is my exchange body not being returned
> > back to caller. Caller is seeing 204 no content found. While, when i
> remove
> > doTry and doCatch() with same code, caller is able to see proper response
> > (exchange body, status and all). Why is that?
> >
>

Re: Is onFinally() compulsory after doCatch()?

Posted by Christian Müller <ch...@gmail.com>.
Check out the link I already sent to you [1].

[1] http://camel.apache.org/try-catch-finally.html

Best,
Christian
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Tue, Jul 2, 2013 at 7:50 AM, Tarun Kumar <ag...@gmail.com>wrote:

> my route looks like this:
>
> from().
> .toTry().process()
> .doCatch(Exception.class)
> .to().to().process()
> .end()
>
>
> My questions are:
>
> 1. is .doFinally compulsory after doCatch()?
> 2. In my case, how does route know whether second .to() in line 4 is inside
> doCatch() or after doCatch()?
> 3. I am using cxfrs component, why is my exchange body not being returned
> back to caller. Caller is seeing 204 no content found. While, when i remove
> doTry and doCatch() with same code, caller is able to see proper response
> (exchange body, status and all). Why is that?
>