You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (Jira)" <ji...@apache.org> on 2021/04/14 10:19:00 UTC

[jira] [Created] (CAMEL-16504) YAML Dsl : support for "flow" like route definition

Luca Burgazzoli created CAMEL-16504:
---------------------------------------

             Summary: YAML Dsl : support for "flow" like route definition
                 Key: CAMEL-16504
                 URL: https://issues.apache.org/jira/browse/CAMEL-16504
             Project: Camel
          Issue Type: Improvement
          Components: camel-yaml-dsl
            Reporter: Luca Burgazzoli
            Assignee: Luca Burgazzoli
             Fix For: 3.10.0


Assuming we have the following route in Java:

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

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:

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

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 the fact that they support outputs or not so the same route can be rewritten in YAML like:

{code:yaml}
- from:
     uri: "direct:a"
    steps
      - split:
           tokenize: \n"
      - log: "${body}"
{code}
 
In this case, as the split processor does not have any defined step, we can wire the log processor to split's output. 




--
This message was sent by Atlassian Jira
(v8.3.4#803005)