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/11/25 14:05:18 UTC

[camel-kamelets] 02/06: Added Infinispan Sink Kamelet

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

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

commit 5642fd35eb87b0d5f3bf578d12091923717c8410
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Nov 25 14:42:14 2021 +0100

    Added Infinispan Sink Kamelet
---
 .../kamelets/infinispan-sink.kamelet.yaml          | 115 +++++++++++++++++++++
 1 file changed, 115 insertions(+)

diff --git a/library/camel-kamelets/src/main/resources/kamelets/infinispan-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/infinispan-sink.kamelet.yaml
new file mode 100644
index 0000000..e801d59
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/infinispan-sink.kamelet.yaml
@@ -0,0 +1,115 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: infinispan-sink
+  labels:
+    camel.apache.org/kamelet.type: "source"
+  annotations:
+    camel.apache.org/kamelet.support.level: "Preview"
+    camel.apache.org/catalog.version: "main-SNAPSHOT"
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Infinispan"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyBpZD0iYXJ0d29yayIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTAyNCAyMTUiPjxkZWZzPjxzdHlsZT4uY2xzLTF7ZmlsbDojMGIyNTQ1O30uY2xzLTJ7ZmlsbDojNTk5ZmM2O308L3N0eWxlPjwvZGVmcz48cmVjdCBjbGFzcz0iY2xzLTEiIHg9IjI5Ny4yNCIgeT0iMS45OCIgd2lkdGg9IjExLjkiIGhlaWdodD0iMTU4LjEyIi8+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMzk1LjI1LDY0Ljg4Yy03LjgxLTkuNDUtMTguOS0xNC4yNC0zMy0xNC4yNC0xMy43NywwLTI0LjczLDQuNzUtMzIuNjQsMTQuMTFWNTIuMzlIMz [...]
+spec:
+  definition:
+    title: "Infinispan Sink"
+    description: |-
+      Write object to an Infinispan cache.
+
+      The Kamelet expects the following headers to be set:
+
+      - `key` / `ce-key`: as the key to use when put an object in the Infinispan cache.
+
+      If the header won't be set the exchange ID will be used as key.
+    required:
+      - cacheName
+      - hosts
+      - username
+      - password
+    type: object
+    properties:
+      cacheName:
+        title: Cache Name
+        description: The name of the Infinispan cache to use
+        type: String
+      hosts:
+        title: Hosts
+        description: Specifies the host of the cache on Infinispan instance
+        type: String
+      secure:
+        title: Secure
+        description: If the Infinispan instance is secured or not
+        type: boolean
+        default: true
+        x-descriptors:
+        - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+      username:
+        title: Username
+        description: Username to connect to Infinispan.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: Password to connect to Infinispan.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:alm:descriptor:com.tectonic.ui:password
+        - urn:camel:group:credentials
+      saslMechanism:
+        title: SASL Mechanism
+        description: The SASL Mechanism to use
+        type: String
+        default: "DIGEST-MD5"
+      securityRealm:
+        title: Security Realm
+        description: Define the security realm to access the infinispan instance
+        type: string
+        default: "default"
+      securityServerName:
+        title: Security Server name
+        description: Define the security server name to access the infinispan instance
+        type: string
+        default: "infinispan"
+  dependencies:
+    - "camel:kamelet"
+    - "camel:core"
+    - "camel:infinispan"
+  flow:
+    beans:
+      - name: local-infinispan
+        type: "#class:org.apache.camel.component.infinispan.remote.InfinispanRemoteComponent"
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[key]}"
+            steps:
+            - set-header:
+                name: CamelInfinispanKey
+                simple: "${header[key]}"
+          - simple: "${header[ce-key]}"
+            steps:
+            - set-header:
+                name: CamelInfinispanKey
+                simple: "${header[ce-key]}"
+          otherwise:
+            steps:
+            - set-header:
+                name: CamelInfinispanKey
+                simple: "${exchangeId}"
+      - set-header:
+          name: CamelInfinispanValue
+          simple: "${body}"
+      - to:
+          uri: "{{local-infinispan}}:{{cacheName}}"
+          parameters:
+            hosts: "{{hosts}}"
+            secure: "{{secure}}"
+            username: "{{username}}"
+            password: "{{password}}"
+            saslMechanism: "{{saslMechanism}}"
+            securityRealm: "{{securityRealm}}"
+            securityServerName: "{{securityServerName}}"