camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raúl Kripalani (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7180) Support multiple onWhen + onOtherwise in onComplete blocks
Date Tue, 29 Sep 2015 15:42:04 GMT

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

Raúl Kripalani commented on CAMEL-7180:
---------------------------------------

You're right. I was going for syntactic sugar, but there has been no further demand on this
ticket so I think the community doesn't need it.

However, I do see this being useful not in the context of a choice where only 1 path would
be taken, but in a "condition guards" use-case, e.g.:

{code}
.onCompletion().onCompleteOnly()
    .onWhen(xpath("/result = 'ok'"))
        .log("All good!")
    .onWhen(xpath("/result/code = 'abc-0001'"))
        .log("Code abc-0001")
.end()
{code}

Each condition would be satisfied by itself, without interrupting the block if one matches.

Currently, one doesn't have an easy way of implementing this routing logic if not using multicast
+ filters, right?

In this case, we'd obviously drop the {{onOtherwise}} DSL.

> Support multiple onWhen + onOtherwise in onComplete blocks
> ----------------------------------------------------------
>
>                 Key: CAMEL-7180
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7180
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.12.2
>            Reporter: Raúl Kripalani
>            Assignee: Raúl Kripalani
>
> Will allow for something like:
> {code}
> .onCompletion().onCompleteOnly()
>     .onWhen(xpath("/result = 'ok'"))
>         .log("All good!")
>     .onWhen(xpath("/result = 'warn'"))
>         .log(LoggingLevel.WARN, "Something didn't go quite as right!")
>     .onOtherwise()
>         .log(LoggingLevel.ERROR, "Something went awfully wrong!")
> .end()
> {code}
> This will specifically benefit route-level onComplete blocks, as only 1 is supported
per route. Currently, if you want to take decisions, you have to create a nested choice()
which feels clumsy, given that the onComplete DSL already supports some degree of decision-making.



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

Mime
View raw message