You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Jyrki Ruuskanen (JIRA)" <ji...@apache.org> on 2015/10/27 17:13:27 UTC

[jira] [Comment Edited] (CAMEL-9262) stopOnSuccess in Multicast, RecipientList

    [ https://issues.apache.org/jira/browse/CAMEL-9262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14976610#comment-14976610 ] 

Jyrki Ruuskanen edited comment on CAMEL-9262 at 10/27/15 4:12 PM:
------------------------------------------------------------------

This seems to be possible with nested doTrys, but the nesting will quickly get deep. Also, handled(false) in doCatch, which allows us to fall back to context level error handler, seems to be deprecated.

{code:title=Nested doTry example}
.doTry()
   .log("connecting #1")
   .to("ftp://localhost")
.doCatch(Exception.class)
   .doTry()
      .log("connecting #2")
      .to("ftp://localhost/2")
   .doCatch(Exception.class)
      .handled(false)
   .end()
.end();
{code}

I guess handled(false) can be replaced with something like: {{.throwException(new Exception("All producers failed"))}}, but it's not quite the same.


was (Author: yuruki):
This seems to be possible with nested doTrys, but the nesting will quickly get deep. Also, handled(false) in doCatch, which allows us to fall back to context level error handler, seems to be deprecated.

{code:title=Nested doTry example}
.doTry()
   .log("connecting #1")
   .to("ftp://localhost")
.doCatch(Exception.class)
   .doTry()
      .log("connecting #2")
      .to("ftp://localhost/2")
   .doCatch(Exception.class)
      .handled(false)
   .end()
.end();
{code}

> stopOnSuccess in Multicast, RecipientList
> -----------------------------------------
>
>                 Key: CAMEL-9262
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9262
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Jyrki Ruuskanen
>            Priority: Minor
>
> Let's say we have an endpoint where we should send a message and if sending fails there are a number of fallback endpoints we should try stopping after the first successful sending (=no exception thrown during sending).
> This sounds like a case for doTry..doCatch, but then we can't use defaultErrorHander and friends.
> I think it would look quite right if we could say .stopOnSuccess() or .shortCircuit() on multicast and have it stop after the first successful send.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)