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/06/18 11:22:36 UTC
[camel-kamelets] 02/04: Added MySQL Source Kamelet
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch mysql-source
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit b24931c454db1208131aa2d27571b2a69aa63844
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Jun 18 13:21:21 2021 +0200
Added MySQL Source Kamelet
---
.../resources/kamelets/mysql-source.kamelet.yaml | 96 ++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/library/camel-kamelets-catalog/src/main/resources/kamelets/mysql-source.kamelet.yaml b/library/camel-kamelets-catalog/src/main/resources/kamelets/mysql-source.kamelet.yaml
new file mode 100644
index 0000000..345f522
--- /dev/null
+++ b/library/camel-kamelets-catalog/src/main/resources/kamelets/mysql-source.kamelet.yaml
@@ -0,0 +1,96 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+ name: mysql-source
+ 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: "source"
+spec:
+ definition:
+ title: "MySQL Source"
+ description: |-
+ Query data from a MySQL Database.
+
+ In you KameletBinding file you'll need to explicitly declare the SQL Server driver dependency in spec->integration->dependencies
+
+ - "mvn:mysql:mysql-connector-java:<version>"
+ required:
+ - serverName
+ - username
+ - password
+ - query
+ - databaseName
+ 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
+ default: 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
+ example: 'INSERT INTO accounts (username,city) VALUES (:#username,:#city)'
+ databaseName:
+ title: Database Name
+ description: The Database Name we are pointing
+ type: string
+ consumedQuery:
+ title: Consumed Query
+ description: A query to run on a tuple consumed
+ type: string
+ example: 'DELETE FROM accounts where user_id = :#user_id'
+ types:
+ out:
+ mediaType: application/json
+ 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: "sql:{{query}}"
+ parameters:
+ dataSource: "#bean:{{dsBean}}"
+ onConsume: "{{?consumedQuery}}"
+ steps:
+ - marshal:
+ json:
+ library: Jackson
+ - to: "kamelet:sink"
+