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

YAML Dsl : support for "flow" like route definition

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.10.0
    • camel-yaml-dsl
    • None
    • Unknown

    Description

      Assuming we have the following route in Java:

      from("direct:a")
          .split().tokenize("\n"))
              .log("${body}");
      

      This route will log each individual item produced as a result of splitting the incoming message with the given token and to implement the same in YAML, you need something like:

      - from: 
           uri: "direct:a"
          steps
            - split: 
                 tokenize: \n"
               steps: 
                 - log: "${body}"
      

      Which is fine but a a little bit verbose and convoluted if compared to the Java counterpart.

      We could improve the dsl by introducing an option to enable chaining processors based on if they support outputs or not so the same route can be rewritten in YAML like:

      - from: 
          uri: "direct:a"
          steps: 
            - split: 
                 tokenize: \n"
            - log: "${body}"
      

      In this case, as the split processor does not have any defined step, we can wire the log processor to split's output.

      Attachments

        Issue Links

          Activity

            People

              lb Luca Burgazzoli
              lb Luca Burgazzoli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: