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

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

commit 0e1068df28526e0a21f27f588dd164ef23722e8a
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Fri Jun 11 15:37:41 2021 +0200

    Added MySQL Sink Kamelet
---
 .../resources/kamelets/mysql-sink.kamelet.yaml     | 90 ++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git 
a/library/camel-kamelets-catalog/src/main/resources/kamelets/mysql-sink.kamelet.yaml
 
b/library/camel-kamelets-catalog/src/main/resources/kamelets/mysql-sink.kamelet.yaml
new file mode 100644
index 0000000..1c0343a
--- /dev/null
+++ 
b/library/camel-kamelets-catalog/src/main/resources/kamelets/mysql-sink.kamelet.yaml
@@ -0,0 +1,90 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: mysql-sink
+  annotations:
+    camel.apache.org/kamelet.support.level: "Preview"
+    camel.apache.org/catalog.version: "main-SNAPSHOT"
+    camel.apache.org/kamelet.icon: 
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmVyc2lvbj0iMSI+CiA8cmVjdCBmaWxsPSIjMjY1NTdjIiB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHg9Ii0zMCIgeT0iLTMwIiByeD0iMS40IiByeT0iMS40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLC0xLC0xLDAsMCwwKSIvPgogPHBhdGggb3BhY2l0eT0iLjIiIGQ9Im04LjAyNTQgOC4wMDAxYy0wLjc4MjUtMC4wMTY2LTEuMTQ5NCAwLjUyNDQtMC45ODgzIDEuNDU3IDAuMDUyIDAuMzAwNiAwLjMxNTIgMC43Mjk5IDAuODgyOCAxLjQ0MTkgMC42MzEyMiAwLj
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SQL"
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+spec:
+  definition:
+    title: "MySQL Sink"
+    description: |-
+      Send data to a MySQL Database.
+
+      In you KameletBinding file you'll need to explicitly declare the mysql 
driver dependency, like in the following YAML snippet
+      
+      spec:
+        integration:
+          dependencies:
+          - "mvn:mysql:mysql-connector-java:<version>"
+    required:
+      - serverName
+      - port
+      - username
+      - password
+      - databaseName
+      - query
+    type: object
+    properties:
+      serverName:
+        title: Server Name
+        description: Server Name for the data source
+        type: string
+        example: localhost
+      port:
+        title: Port
+        description: Server Port for the data source
+        type: string
+        example: 3306
+      username:
+        title: Username
+        description: The username to use for accessing a secured MySQL Database
+        type: string
+      password:
+        title: Password
+        description: The password to use for accessing a secured MySQL Database
+        type: string
+        format: password
+        x-descriptors:
+        - urn:alm:descriptor:com.tectonic.ui:password
+      query:
+        title: Query
+        description: The Query to execute against the MySQL Database
+        type: string
+      databaseName:
+        title: Database Name
+        description: The Database Name we are pointing
+        type: string
+  dependencies:
+  - "camel:jackson"
+  - "camel:kamelet"
+  - "camel:sql"
+  - "mvn:org.apache.commons:commons-dbcp2:2.8.0"
+  flow:
+    beans:
+      - name: dsBean
+        type: "#class:org.apache.commons.dbcp2.BasicDataSource"
+        property:
+          - key: username
+            value: '{{username}}'
+          - key: password
+            value: '{{password}}'
+          - key: url
+            value: 'jdbc:mysql://{{serverName}}:{{port}}/{{databaseName}}'
+          - key: driverClassName
+            value: 'com.mysql.cj.jdbc.Driver'
+    from:
+      uri: "kamelet:source"
+      steps:
+      - unmarshal:
+          json: 
+            library: Jackson
+      - to: 
+          uri: "sql:{{query}}"
+          parameters:
+            dataSource: "#bean:{{dsBean}}"

Reply via email to