onException with Throwable.class

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

onException with Throwable.class

atg roxx
Hi Team,

While working on my camel project and noticed (a bug perhaps ) that when
you add onException(Throwable.class) to your route, all exception go to
this onException(Throwable.class) block.

Problem is explained in below scenerio.


Scenerio 1 :  does not work .   onException(IrrecoverableException.class,
Throwable.class) is called.
---------------------------------------------
  onException(*RecoverableException*.class)
                .maximumRedeliveries("3")
                .redeliveryDelay("1000")
                .end();

    // this block is to capture any runtime or other exception
  onException(*IrrecoverableException*.class, *Throwable*.class)
                .log(LoggingLevel.WARN, "Irrecoverable error");



from("direct:start")
              .throwException(new RecoverableException("recoverable
exception"))
               .end();

------------------------------------------------------------------------


Scenerio 2 :  This works fine and onException(RecoverableException.class)
is called
-------------------------------------------------------------------------
  onException(*RecoverableException*.class)
                .maximumRedeliveries("3")
                .redeliveryDelay("1000")
                .end();

     // this block is to capture any runtime or other exception
  onException(*IrrecoverableException*.class, *Exception*.class)
                .log(LoggingLevel.WARN, "Irrecoverable error");



from("direct:start")
              .throwException(new RecoverableException("recoverable
exception"))
               .end();

------------------------------------------------------------------------


Could you explain the why this is happening or I am doing anything wrong




-Regards
atg roxx
Reply | Threaded
Open this post in threaded view
|

Re: onException with Throwable.class

Claus Ibsen-2
Hi

What version of Camel do you use?


On Mon, Apr 13, 2015 at 12:45 PM, atg roxx <[hidden email]> wrote:

> Hi Team,
>
> While working on my camel project and noticed (a bug perhaps ) that when you
> add onException(Throwable.class) to your route, all exception go to this
> onException(Throwable.class) block.
>
> Problem is explained in below scenerio.
>
>
> Scenerio 1 :  does not work .   onException(IrrecoverableException.class,
> Throwable.class) is called.
> ---------------------------------------------
>   onException(RecoverableException.class)
>                 .maximumRedeliveries("3")
>                 .redeliveryDelay("1000")
>                 .end();
>
>     // this block is to capture any runtime or other exception
>   onException(IrrecoverableException.class, Throwable.class)
>                 .log(LoggingLevel.WARN, "Irrecoverable error");
>
>
>
> from("direct:start")
>               .throwException(new RecoverableException("recoverable
> exception"))
>                .end();
>
> ------------------------------------------------------------------------
>
>
> Scenerio 2 :  This works fine and onException(RecoverableException.class) is
> called
> -------------------------------------------------------------------------
>   onException(RecoverableException.class)
>                 .maximumRedeliveries("3")
>                 .redeliveryDelay("1000")
>                 .end();
>
>      // this block is to capture any runtime or other exception
>   onException(IrrecoverableException.class, Exception.class)
>                 .log(LoggingLevel.WARN, "Irrecoverable error");
>
>
>
> from("direct:start")
>               .throwException(new RecoverableException("recoverable
> exception"))
>                .end();
>
> ------------------------------------------------------------------------
>
>
> Could you explain the why this is happening or I am doing anything wrong
>
>
>
>
> -Regards
> atg roxx



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Reply | Threaded
Open this post in threaded view
|

Re: onException with Throwable.class

Claus Ibsen-2
Hi

I cannot reproduce this with latest code. It would be good if you can
bulild a sample project or unit test that demonstrates the issue.

On Mon, Apr 13, 2015 at 3:34 PM, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> What version of Camel do you use?
>
>
> On Mon, Apr 13, 2015 at 12:45 PM, atg roxx <[hidden email]> wrote:
>> Hi Team,
>>
>> While working on my camel project and noticed (a bug perhaps ) that when you
>> add onException(Throwable.class) to your route, all exception go to this
>> onException(Throwable.class) block.
>>
>> Problem is explained in below scenerio.
>>
>>
>> Scenerio 1 :  does not work .   onException(IrrecoverableException.class,
>> Throwable.class) is called.
>> ---------------------------------------------
>>   onException(RecoverableException.class)
>>                 .maximumRedeliveries("3")
>>                 .redeliveryDelay("1000")
>>                 .end();
>>
>>     // this block is to capture any runtime or other exception
>>   onException(IrrecoverableException.class, Throwable.class)
>>                 .log(LoggingLevel.WARN, "Irrecoverable error");
>>
>>
>>
>> from("direct:start")
>>               .throwException(new RecoverableException("recoverable
>> exception"))
>>                .end();
>>
>> ------------------------------------------------------------------------
>>
>>
>> Scenerio 2 :  This works fine and onException(RecoverableException.class) is
>> called
>> -------------------------------------------------------------------------
>>   onException(RecoverableException.class)
>>                 .maximumRedeliveries("3")
>>                 .redeliveryDelay("1000")
>>                 .end();
>>
>>      // this block is to capture any runtime or other exception
>>   onException(IrrecoverableException.class, Exception.class)
>>                 .log(LoggingLevel.WARN, "Irrecoverable error");
>>
>>
>>
>> from("direct:start")
>>               .throwException(new RecoverableException("recoverable
>> exception"))
>>                .end();
>>
>> ------------------------------------------------------------------------
>>
>>
>> Could you explain the why this is happening or I am doing anything wrong
>>
>>
>>
>>
>> -Regards
>> atg roxx
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: [hidden email]
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Reply | Threaded
Open this post in threaded view
|

Re: onException with Throwable.class

atg roxx
The camel version is 2.14.0.

I did tried and the code is from that sample example.

-Regards,
atg roxx
On Mon, Apr 13, 2015 at 2:48 PM, Claus Ibsen <[hidden email]> wrote:

> Hi
>
> I cannot reproduce this with latest code. It would be good if you can
> bulild a sample project or unit test that demonstrates the issue.
>
> On Mon, Apr 13, 2015 at 3:34 PM, Claus Ibsen <[hidden email]>
> wrote:
> > Hi
> >
> > What version of Camel do you use?
> >
> >
> > On Mon, Apr 13, 2015 at 12:45 PM, atg roxx <[hidden email]> wrote:
> >> Hi Team,
> >>
> >> While working on my camel project and noticed (a bug perhaps ) that
> when you
> >> add onException(Throwable.class) to your route, all exception go to this
> >> onException(Throwable.class) block.
> >>
> >> Problem is explained in below scenerio.
> >>
> >>
> >> Scenerio 1 :  does not work .
>  onException(IrrecoverableException.class,
> >> Throwable.class) is called.
> >> ---------------------------------------------
> >>   onException(RecoverableException.class)
> >>                 .maximumRedeliveries("3")
> >>                 .redeliveryDelay("1000")
> >>                 .end();
> >>
> >>     // this block is to capture any runtime or other exception
> >>   onException(IrrecoverableException.class, Throwable.class)
> >>                 .log(LoggingLevel.WARN, "Irrecoverable error");
> >>
> >>
> >>
> >> from("direct:start")
> >>               .throwException(new RecoverableException("recoverable
> >> exception"))
> >>                .end();
> >>
> >> ------------------------------------------------------------------------
> >>
> >>
> >> Scenerio 2 :  This works fine and
> onException(RecoverableException.class) is
> >> called
> >>
> -------------------------------------------------------------------------
> >>   onException(RecoverableException.class)
> >>                 .maximumRedeliveries("3")
> >>                 .redeliveryDelay("1000")
> >>                 .end();
> >>
> >>      // this block is to capture any runtime or other exception
> >>   onException(IrrecoverableException.class, Exception.class)
> >>                 .log(LoggingLevel.WARN, "Irrecoverable error");
> >>
> >>
> >>
> >> from("direct:start")
> >>               .throwException(new RecoverableException("recoverable
> >> exception"))
> >>                .end();
> >>
> >> ------------------------------------------------------------------------
> >>
> >>
> >> Could you explain the why this is happening or I am doing anything wrong
> >>
> >>
> >>
> >>
> >> -Regards
> >> atg roxx
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: [hidden email]
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> > hawtio: http://hawt.io/
> > fabric8: http://fabric8.io/
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: [hidden email]
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>