Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full yaml dsl #80 #84

Merged
merged 5 commits into from
Jun 21, 2019
Merged

Conversation

lburgazzoli
Copy link
Contributor

@lburgazzoli lburgazzoli commented Jun 20, 2019

Fixes #80

This is the first iteration for an YAMLesque DSL so that you can define routes as:

- from:
    uri: "direct:start"
    steps:
     - choice:
         when:
           - simple: "${body.contains(\",\")}"
             steps:
               - to: "log:when-comma"
               - split:
                   tokenize: ","
                   steps:
                    - to: "log:when-semicolon"
           - simple: "${body.startsWith(\";\")}"
             steps:
               - to: "log:when-semicolon"
               - split:
                   tokenize: ";"
                   steps:
                    - to: "log:when-semicolon"
         otherwise:
           steps:
             - to: "log:otherwise"
     - to: "log:info"

- rest:
    verb: "post"
    uri: "/route"
    steps:
     - unmarshal:
         json:
             library: "Jackson"
             unmarshal-type: "my.Pojo"
     - to: "log:info"

The DSL can be extended by providing a "service" like file, see as example the custom step handler for knative here in the pr.

What's left:

  • better documentation
  • support for additional EIPs

The DSL support also a "flow style" where the inner steps for things such as filter or split can be omitted:

- from:
    uri: "direct:flow"
    steps:
      - split:
          tokenizer: ","
      - to: "mock:flow"

@lburgazzoli lburgazzoli force-pushed the github-80-yaml branch 2 times, most recently from f13a676 to 253358b Compare June 20, 2019 08:48
@davsclaus
Copy link
Contributor

Looks really good. Only found cosmetic issues in the comments.

However I do think we should think about the naming of converter as it reminds too much about type converters from Camel. I would like to come up with a new name in the near future.

Really like the groovy testing stuff you do for all the EIPs.

@valdar
Copy link
Member

valdar commented Jun 20, 2019

+1 on the converter naming, some proposals:

  • StepParser
  • StepHandler

@lburgazzoli
Copy link
Contributor Author

@davsclaus @valdar yeah, the things have originally started as plain jackson converters so named according but it turned out it was not possible to fully marshal/unmarshal steps using standard things.

Any suggestion for a better naming is very welcome.

@lburgazzoli
Copy link
Contributor Author

ok, working on renaming things to StepParser

@valdar @davsclaus do you mind doing a second review ?

@davsclaus
Copy link
Contributor

Yeah StepParser is better than Converter

Copy link
Member

@valdar valdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lburgazzoli lburgazzoli merged commit d826830 into apache:master Jun 21, 2019
@lburgazzoli lburgazzoli deleted the github-80-yaml branch June 21, 2019 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support full yaml dsl
4 participants