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/09/14 10:11:31 UTC

[camel-kamelets] 01/03: Support Subject as header into sns sink

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

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

commit d2bc1a4cca9a1ad02a02666afb5ff8173b5eb630
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Sep 14 12:08:37 2021 +0200

    Support Subject as header into sns sink
---
 aws-sns-sink.kamelet.yaml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/aws-sns-sink.kamelet.yaml b/aws-sns-sink.kamelet.yaml
index 66252d7..213efb5 100644
--- a/aws-sns-sink.kamelet.yaml
+++ b/aws-sns-sink.kamelet.yaml
@@ -15,6 +15,10 @@ spec:
     title: AWS SNS Sink
     description: |-
       Send message to an AWS SNS Topic
+
+      The Kamelet expects the following headers to be set:
+
+      - `subject` / `ce-subject`: the subject of the message
     required:
       - topicNameOrArn
       - accessKey
@@ -59,6 +63,18 @@ spec:
     from:
       uri: kamelet:source
       steps:
+      - choice:
+          when:
+          - simple: "${header[subject]}"
+            steps:
+            - set-header:
+                name: CamelAwsSnsSubject
+                simple: "${header[subject]}"
+          - simple: "${header[ce-subject]}"
+            steps:
+            - set-header:
+                name: CamelAwsSnsSubject
+                simple: "${header[ce-subject]}"
       - to:
           uri: "aws2-sns:{{topicNameOrArn}}"
           parameters: