davsclaus commented on a change in pull request #84: Support full yaml dsl #80
URL: https://github.com/apache/camel-k-runtime/pull/84#discussion_r295798644
 
 

 ##########
 File path: camel-k-runtime-yaml/README.adoc
 ##########
 @@ -0,0 +1,204 @@
+YAML DSL
+========
+
+This artifact provides a YAML based DSL for Apache Camel and Apache Camel K.
+
+[WARNING]
+====
+experimental
+====
+
+=== Defining a route
+
+A route is a sequence of elements, or `steps`, defined as follow:
+
+[source, yaml]
+----
+from: #<1>
+  uri: "direct:start"
+  steps: #<2>
+    - filter:
+        expression:
+          simple: "${in.header.continue} == true"
+        steps: #<2>
+          - to:
+              uri: "log:filtered"
+    - to:
+        uri: "log:original"
+----
+<1> route entry point, by default `from` and `rest` are supported
+<2> processing steps
+
+[NOTE]
+====
+Each step is represented by YAML map that has a single entry where the field 
name is the EIP name
+====
+
+As general rule each step provide all the parameters the related definition 
declares but there are some minor differences/enhancements:
+
+- *Output Aware Steps*
++
+Some steps such as `filter` and `split` have their own pipeline when an 
exchange matches the filter expression or for the items generated by the split 
expression, such pipeline can be defined by the `steps` field:
++
+[source, yaml]
+----
+filter:
+  expression:
+    simple: "${in.header.continue} == true"
+      steps:
+        - to:
+            uri: "log:filtered"
+----
++
+[NOTE]
+====
+if the `steps` field is omitted, then each subsequent step is considered part 
of the filter pipeline.
+====
+
+- *Expression Aware Steps*
++
+Some EIP such as `filter` and `split` supports the definition of an expression 
through the `expression` field:
++
+[source, yaml]
+.Explicit Expression field
+----
+filter:
+    expression:
+      simple: "${in.header.continue} == true"
+----
++
+To make the DSL less verbose, the `expression` field can be omitted:
++
+[source, yaml]
+.Implicit Expression field
+----
+filter:
+    simple: "${in.header.continue} == true"
+----
++
+In general expression can be defined inline like in the examples above but in 
case you need provide more information, you can 'unroll' the expression 
definition and  configure any single parameter the expression defines.
++
+[source, yaml]
+.Full Expression definition
+----
+filter:
+    tokenize:
+      token: "<"
+      end-token: ">"
+----
+
+- *Data Format Aware Steps*
++
+Some EIP such as `set-body` and `marshal` supports the definition of a data 
formats through the `data-format` field:
++
+[source, yaml]
+.Explicit Data Format field
+----
+set-body:
+    data-format:
+      json:
+        library: Jackson
+----
++
+To make the DSL less verbose, the `data-format` field can be omitted:
++
+[source, yaml]
+.Implicit Data Format field
+----
+set-body:
+    json:
 
 Review comment:
   I think in Camel 3 we now use jackson as the default library

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to