camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: handling exception at endpoints
Date Thu, 12 Apr 2012 07:40:04 GMT
On Wed, Apr 11, 2012 at 9:15 PM, Marco Mistroni <mmistroni@gmail.com> wrote:
> Hello Claus
>  thanks for the reply!
> mm i may be confusing the terminology sorry :(
>
> my camelapp consists of few routes.
> Most of the routes have as  <camel:to uri="bean:endpointBean?method=handle"
> />
>
> i want to be able to handle exceptions in my endpointBean....
>

So you want to have endpointBean being invoked, calling the handle
method, when any exception occurs during processing messages in Camel?

You can define an onException to do that

Something a like. You can add before your routes in the XML file.

  <onException>
    <exception>java.lang.Exception</exception>
    <handled>
      <constant>true</constant>
    </handled>
    <to uri="bean:endpointBean?method=handle">
  </onException>

See more details here:
http://camel.apache.org/exception-clause.html


And if you got a copy of the Camel in Action book, I suggest to read
chapter 5, which is all about error handling.


> apart from the post below (i see you commented on that as well) are there
> any other approaches to handle
> exceptions in endpoints?
>
> w/kindest regards
>  marco
>
>
>
> On Wed, Apr 11, 2012 at 6:47 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
>
>> On Tue, Apr 10, 2012 at 10:46 PM, Marco Mistroni <mmistroni@gmail.com>
>> wrote:
>> > Hello all
>> >  i'd like to be able to handle exceptions at Endpoints in my app (as most
>> > of the exceptions happen when endpoints are processing data).
>> > as i plan to deploy my camel app remotely, i'd like to handle the
>> exception
>> > so that an email with the exception is sent to me.
>> >
>>
>> Can you tell a bit more what you mean by your endpoints process data.
>> Its  the consumer or producers of the endpoints that process data.
>>
>> > i found out this thread with regards to exception handling at endpoints,
>> > and was wondering if any changes have been introduced in camel to handle
>> > exception at endpoints since this post
>> >
>> >
>> http://camel.465427.n5.nabble.com/Endpoint-exception-handling-td5504378.html
>> >
>> > w/kindest regards
>> >  marco
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message