You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Lichtin <li...@yahoo.com.INVALID> on 2017/05/13 07:00:15 UTC

In 'onException' - how to decide per-message whether to 'continue' route or not

One can define a route exception handling to catch and continue:

  rd.onException(Exception.class).continued(true).process(myExceptionHandler)

However, how can one decide on a per-message basis (ie. in myExceptionHandler) whether to continue with the route or not?

Thanks
- Martin


Re: Re: In 'onException' - how to decide per-message whether to 'continue' route or not

Posted by Martin Lichtin <li...@yahoo.com.INVALID>.
Thanks, onWhen pointed me into the right direction.
I can use a predicate like:

rd.onException(Exception.class).continued(new Predicate() {
             @Override
             public boolean matches(Exchange exchange) {
               return myDecision(exchange);
             }
           })

On 13.05.2017 09:35, Claus Ibsen wrote:
> You can add  onWhen where you can do a predicate to decide that per message
>
> On Sat, May 13, 2017 at 9:00 AM, Martin Lichtin
> <li...@yahoo.com.invalid> wrote:
>> One can define a route exception handling to catch and continue:
>>
>>   rd.onException(Exception.class).continued(true).process(myExceptionHandler)
>>
>> However, how can one decide on a per-message basis (ie. in
>> myExceptionHandler) whether to continue with the route or not?
>>
>> Thanks
>> - Martin
>>
>
>


Re: In 'onException' - how to decide per-message whether to 'continue' route or not

Posted by Claus Ibsen <cl...@gmail.com>.
You can add  onWhen where you can do a predicate to decide that per message

On Sat, May 13, 2017 at 9:00 AM, Martin Lichtin
<li...@yahoo.com.invalid> wrote:
> One can define a route exception handling to catch and continue:
>
>  rd.onException(Exception.class).continued(true).process(myExceptionHandler)
>
> However, how can one decide on a per-message basis (ie. in
> myExceptionHandler) whether to continue with the route or not?
>
> Thanks
> - Martin
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2