Hello Claus,
 sorry to bother, but i am still losing the plot with Exception Handling :(
i read Camel In action chapter, and this is what i came out with:

    <camel:route>
            <camel:from uri="seda:processBloombergShares" />
            <camel:onException>
                <camel:exception>java.lang.Exception</camel:exception>
                <camel:handled>
                    <camel:constant>true</camel:constant>
                </camel:handled>
                <camel:to
uri="bean:exceptionHandler?method=handleException" />
            </camel:onException>

            <camel:process ref="bloombergProcessor" />
            <camel:bean ref="bloombergServiceActivator" method="fetchData"
/>
            <camel:to uri="bean:endpointBean?method=handleBloombergShare" />

   </camel:route>

   the BloombergProcessor is throwing an Exception , as in code b elow
public void process(Exchange exchange) throws Exception {
        // TODO Auto-generated method stub
        Set<String> set = new HashSet<String>();

        set.add("BLOOMBERG-WMT");
        //set.add("BLOOMBERG-GE");

        String portfolio = (String)exchange.getIn().getBody();



        throw new Exception("Exception from Bloomberg PRocessor...");
  }

this is the signature of my exception handler handleException method

public void handleException(Map<?, ?> in, String payload, Map<String,
Object> out) {
        LOGGER.info("-------Handling exceptions:");
        //exceptions.add(exception);
}


But somehow that method is never called...
am i using the right signature?
what am i forgetting?

w/kindest regards
 marco









On Thu, Apr 12, 2012 at 8:07 PM, Marco Mistroni <[email protected]> wrote:

> thaks Claus for the useful advices
>
> rgds
>  marco
>
>
> On Thu, Apr 12, 2012 at 8:40 AM, Claus Ibsen <[email protected]>wrote:
>
>> On Wed, Apr 11, 2012 at 9:15 PM, Marco Mistroni <[email protected]>
>> 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 <[email protected]>
>> wrote:
>> >
>> >> On Tue, Apr 10, 2012 at 10:46 PM, Marco Mistroni <[email protected]>
>> >> 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: [email protected]
>> >> 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: [email protected]
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>
>

Reply via email to