Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5146

Java DSL - Let ValueBuilder be Predicate to make it easier to use predicates in the Java DSL

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.10.0
    • camel-core
    • None
    • Unknown

    Description

      The Java DSL with the RouteBuilder has a number of built-in predicates and expressions we use in the DSL. Such as with the CBR or Filter etc to define predicates.

      ValueBuilder contains many out of the box predicates for the DSL. We should let it be predicate as well.

      Then you can use compound predicates such as with not, to stack predicates together:

                      from("direct:start")
                          .filter(not(header("foo")))
                              .to("mock:result");
      

      Before this was not possible as header from ValueBuilder is only an expression. And to fix that you would have to convert that to a predicate using a toPredicate static method. Which makes the DSL more verbose and not as stream-lined.

      This causes a slight API change as we need to remove retryWhile(Expression) in OnException as it has 2 methods to accept a predicate or expression. But in reality we should only need the predicate, as that is what retryWhile is about.

      This slight API change will break backwards compatibility (eg retryWhile in OnException) so we will keep this on the 2.10 trunk.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: