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

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

commit 1382197e39bfed7a00cb887bd30ae158b61926e8
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Jun 18 15:19:56 2021 +0200

    Added SQL Server Source Kamelet
---
 .../kamelets/sqlserver-source.kamelet.yaml         | 95 ++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git 
a/library/camel-kamelets-catalog/src/main/resources/kamelets/sqlserver-source.kamelet.yaml
 
b/library/camel-kamelets-catalog/src/main/resources/kamelets/sqlserver-source.kamelet.yaml
new file mode 100644
index 0000000..719f2b6
--- /dev/null
+++ 
b/library/camel-kamelets-catalog/src/main/resources/kamelets/sqlserver-source.kamelet.yaml
@@ -0,0 +1,95 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: sqlserver-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,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm
 [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "SQL"
+  labels:
+    camel.apache.org/kamelet.type: "source"
+spec:
+  definition:
+    title: "Microsoft SQL Server Sink"
+    description: |-
+      Query data from a Microsoft SQL Server Database.
+
+      In you KameletBinding file you'll need to explicitly declare the SQL 
Server driver dependency in spec->integration->dependencies
+
+      - "mvn:com.microsoft.sqlserver:mssql-jdbc:<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: 1433
+      username:
+        title: Username
+        description: The username to use for accessing a secured SQL Server 
Database
+        type: string
+      password:
+        title: Password
+        description: The password to use for accessing a secured SQL Server 
Database
+        type: string
+        format: password
+        x-descriptors:
+        - urn:alm:descriptor:com.tectonic.ui:password
+      query:
+        title: Query
+        description: The Query to execute against the SQL Server 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:
+    in:
+      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:sqlserver://{{serverName}}:{{port}};databaseName={{databaseName}}'
+          - key: driverClassName
+            value: 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
+    from:
+      uri: "sql:{{query}}"
+      parameters:
+        dataSource: "#bean:{{dsBean}}"
+        onConsume: "{{?consumedQuery}}"
+      steps:
+      - marshal:
+          json: 
+            library: Jackson
+      - to: "kamelet:sink"

Reply via email to