You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/04/20 12:58:15 UTC

[camel-kamelets] 01/02: Added Exec Sink Kamelet

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch exec-sink
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 7f24658f5fc6964243bbb35dfff3f956a45430e9
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 20 14:57:45 2021 +0200

    Added Exec Sink Kamelet
---
 exec-sink.kamelet.yaml | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/exec-sink.kamelet.yaml b/exec-sink.kamelet.yaml
index bafa104..78bbadf 100644
--- a/exec-sink.kamelet.yaml
+++ b/exec-sink.kamelet.yaml
@@ -12,6 +12,12 @@ spec:
     title: Exec Sink
     description: |-
       Execute system commands
+
+      The Kamelet expects the following headers to be set:
+
+      - `args/ `ce-args`: as the args to be set on the executable.
+
+      If the header won't be set the executable will be run without arguments.
     required:
       - executable
       - args
@@ -20,17 +26,23 @@ spec:
         title: Executable command
         description: The command to execute
         type: string
-      args:
-        title: The arguments
-        description: Arguments to pass to the executables
-        type: string
   flow:
     from:
       uri: kamelet:source
       steps:
+      - choice:
+          when:
+          - simple: "${header[args]}"
+            steps:
+            - set-header:
+                name: CamelExecCommandArgs
+                simple: "${header[args]}"
+          - simple: "${header[ce-args]}"
+            steps:
+            - set-header:
+                name: CamelExecCommandArgs
+                simple: "${header[ce-args]}"
       - to:
           uri: "exec:{{executable}}"
-          parameters:
-            args: "{{args}}"
       - set-body:
           simple: "${body.stdout}"