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

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

commit 4f107f5fb100da7ed186879899940c26fb4b4290
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue May 4 14:39:46 2021 +0200

    Added Kafka Sink Kamelet
---
 .../resources/kamelets/kafka-sink.kamelet.yaml     | 93 ++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git 
a/library/camel-kamelets-catalog/src/main/resources/kamelets/kafka-sink.kamelet.yaml
 
b/library/camel-kamelets-catalog/src/main/resources/kamelets/kafka-sink.kamelet.yaml
new file mode 100644
index 0000000..44ad970
--- /dev/null
+++ 
b/library/camel-kamelets-catalog/src/main/resources/kamelets/kafka-sink.kamelet.yaml
@@ -0,0 +1,93 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: kafka-sink
+  annotations:
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCA1MDAgNTAwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MD
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+spec:
+  definition:
+    title: "Kafka Sink"
+    description: |-
+      Send data to Kafka topics.
+
+      The Kamelet is able to understand the following headers to be set:
+
+      - `key` / `ce-key`: as message key
+    
+      - `partition-key` / `ce-partition-key`: as message partition key
+
+      Both the headers are optional.
+    required:
+      - topic
+      - brokers
+      - username
+      - password
+    type: object
+    properties:
+      topic:
+        title: Topic Names
+        description: Comma separated list of Kafka topic names
+        type: string
+      brokers:
+        title: Brokers
+        description: Comma separated list of Kafka Broker URLs
+        type: string
+      securityProtocol:
+        title: Security Protocol
+        description: Protocol used to communicate with brokers. 
SASL_PLAINTEXT, PLAINTEXT, SASL_SSL and SSL are supported
+        type: string
+        default: SASL_SSL
+      saslMechanism:
+        title: SASL Mechanism
+        description: The Simple Authentication and Security Layer (SASL) 
Mechanism used. 
+        type: string
+        default: PLAIN
+      username:
+        title: Username
+        description: Username to authenticate to Kafka 
+        type: string
+      password:
+        title: Password
+        description: Password to authenticate to kafka
+        type: string
+        format: password
+        x-descriptors:
+        - urn:alm:descriptor:com.tectonic.ui:password
+  flow:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[key]}"
+            steps:
+            - set-header:
+                name: kafka.KEY
+                simple: "${header[key]}"
+          - simple: "${header[ce-key]}"
+            steps:
+            - set-header:
+                name: kafka.KEY
+                simple: "${header[ce-key]}"
+      - choice:
+          when:
+          - simple: "${header[partition-key]}"
+            steps:
+            - set-header:
+                name: kafka.PARTITION_KEY
+                simple: "${header[partition-key]}"
+          - simple: "${header[ce-partition-key]}"
+            steps:
+            - set-header:
+                name: kafka.PARTITION_KEY
+                simple: "${header[ce-partition-key]}"
+      - to:
+          uri: "kafka:{{topic}}"
+          parameters:
+            brokers: "{{brokers}}"
+            securityProtocol: "{{securityProtocol}}"
+            saslMechanism: "{{saslMechanism}}"
+            saslJaasConfig: 
"org.apache.kafka.common.security.plain.PlainLoginModule required 
username='{{username}}' password='{{password}}';"

Reply via email to