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/12/06 09:25:41 UTC

[camel-kamelets] 01/02: Sync and regen

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 9d845344d2af52a097dcdb4f451122dc1d728bda
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Dec 6 10:24:46 2021 +0100

    Sync and regen
---
 .../ROOT/assets/images/kamelets/redis-sink.svg     |   1 +
 docs/modules/ROOT/nav.adoc                         |   1 +
 docs/modules/ROOT/pages/redis-sink.adoc            | 153 +++++++++++++++++++++
 kamelets/redis-sink.kamelet.yaml                   | 129 +++++++++++++++++
 .../resources/kamelets/redis-sink.kamelet.yaml     | 129 +++++++++++++++++
 templates/bindings/camel-k/redis-sink-binding.yaml |  19 +++
 templates/bindings/core/redis-sink-binding.yaml    |  13 ++
 7 files changed, 445 insertions(+)

diff --git a/docs/modules/ROOT/assets/images/kamelets/redis-sink.svg b/docs/modules/ROOT/assets/images/kamelets/redis-sink.svg
new file mode 100644
index 0000000..313e8bc
--- /dev/null
+++ b/docs/modules/ROOT/assets/images/kamelets/redis-sink.svg
@@ -0,0 +1 @@
+<svg width="2500" height="2148" viewBox="0 0 256 220" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet"><path d="M245.97 168.943c-13.662 7.121-84.434 36.22-99.501 44.075-15.067 7.856-23.437 7.78-35.34 2.09-11.902-5.69-87.216-36.112-100.783-42.597C3.566 169.271 0 166.535 0 163.951v-25.876s98.05-21.345 113.879-27.024c15.828-5.679 21.32-5.884 34.79-.95 13.472 4.936 94.018 19.468 107.331 24.344l-.006 25.51c.002 2.558-3.07 5.364-10.024 8.988" fill="#912626"/><path d="M245 [...]
\ No newline at end of file
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index f5cac61..5cc5b6a 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -114,6 +114,7 @@
 * xref:ROOT:protobuf-deserialize-action.adoc[image:kamelets/protobuf-deserialize-action.svg[] Protobuf Deserialize Action]
 * xref:ROOT:protobuf-serialize-action.adoc[image:kamelets/protobuf-serialize-action.svg[] Protobuf Serialize Action]
 * xref:ROOT:rabbitmq-source.adoc[image:kamelets/rabbitmq-source.svg[] RabbitMQ Source]
+* xref:ROOT:redis-sink.adoc[image:kamelets/redis-sink.svg[] Redis Sink]
 * xref:ROOT:redis-source.adoc[image:kamelets/redis-source.svg[] Redis Source]
 * xref:ROOT:regex-router-action.adoc[image:kamelets/regex-router-action.svg[] Regex Router Action]
 * xref:ROOT:replace-field-action.adoc[image:kamelets/replace-field-action.svg[] Replace Field Action]
diff --git a/docs/modules/ROOT/pages/redis-sink.adoc b/docs/modules/ROOT/pages/redis-sink.adoc
new file mode 100644
index 0000000..bcd97d2
--- /dev/null
+++ b/docs/modules/ROOT/pages/redis-sink.adoc
@@ -0,0 +1,153 @@
+// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
+
+= image:kamelets/redis-sink.svg[] Redis Sink
+
+*Provided by: "Apache Software Foundation"*
+
+*Support Level for this Kamelet is: "Preview"*
+
+Write object to a Redis cache.
+
+== Configuration Options
+
+The following table summarizes the configuration options available for the `redis-sink` Kamelet:
+[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
+|===
+| Property| Name| Description| Type| Default| Example
+| *command {empty}* *| Command| Redis Command| string| `"GET"`| 
+| *redisHost {empty}* *| Redis Host| The host where Redis server is running| string| | 
+| *redisPort {empty}* *| Redis Port| The port where Redis server is running| integer| | 
+| channels| Channels| Redis Channels| string| `"one"`| 
+| serializer| Serializer| RedisSerializer fully qualified name implementation| string| `"org.springframework.data.redis.serializer.StringRedisSerializer"`| 
+|===
+
+NOTE: Fields marked with an asterisk ({empty}*) are mandatory.
+
+
+== Dependencies
+
+At runtime, the `redis-sink` Kamelet relies upon the presence of the following dependencies:
+
+- camel:kamelet
+- camel:core
+- camel:spring-redis 
+
+== Usage
+
+This section describes how you can use the `redis-sink`.
+
+=== Knative Sink
+
+You can use the `redis-sink` Kamelet as a Knative sink by binding it to a Knative object.
+
+.redis-sink-binding.yaml
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: redis-sink-binding
+spec:
+  source:
+    ref:
+      kind: Channel
+      apiVersion: messaging.knative.dev/v1
+      name: mychannel
+  sink:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: redis-sink
+    properties:
+      redisHost: "The Redis Host"
+      redisPort: "The Redis Port"
+  
+----
+
+==== *Prerequisite*
+
+You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster.
+
+==== *Procedure for using the cluster CLI*
+
+. Save the `redis-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
+
+. Run the sink by using the following command:
++
+[source,shell]
+----
+kubectl apply -f redis-sink-binding.yaml
+----
+
+==== *Procedure for using the Kamel CLI*
+
+Configure and run the sink by using the following command:
+
+[source,shell]
+----
+kamel bind channel:mychannel redis-sink -p "sink.redisHost=The Redis Host" -p "sink.redisPort=The Redis Port"
+----
+
+This command creates the KameletBinding in the current namespace on the cluster.
+
+=== Kafka Sink
+
+You can use the `redis-sink` Kamelet as a Kafka sink by binding it to a Kafka topic.
+
+.redis-sink-binding.yaml
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: redis-sink-binding
+spec:
+  source:
+    ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  sink:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: redis-sink
+    properties:
+      redisHost: "The Redis Host"
+      redisPort: "The Redis Port"
+  
+----
+
+==== *Prerequisites*
+
+* You've installed https://strimzi.io/[Strimzi].
+* You've created a topic named `my-topic` in the current namespace.
+* You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster.
+
+==== *Procedure for using the cluster CLI*
+
+. Save the `redis-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
+
+. Run the sink by using the following command:
++
+[source,shell]
+----
+kubectl apply -f redis-sink-binding.yaml
+----
+
+==== *Procedure for using the Kamel CLI*
+
+Configure and run the sink by using the following command:
+
+[source,shell]
+----
+kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic redis-sink -p "sink.redisHost=The Redis Host" -p "sink.redisPort=The Redis Port"
+----
+
+This command creates the KameletBinding in the current namespace on the cluster.
+
+== Kamelet source file
+
+https://github.com/apache/camel-kamelets/blob/main/kamelets/redis-sink.kamelet.yaml
+
+// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
diff --git a/kamelets/redis-sink.kamelet.yaml b/kamelets/redis-sink.kamelet.yaml
new file mode 100644
index 0000000..017dcf9
--- /dev/null
+++ b/kamelets/redis-sink.kamelet.yaml
@@ -0,0 +1,129 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: redis-sink
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+  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: "Redis"
+    camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMTQ4IiB2aWV3Qm94PSIwIDAgMjU2IDIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij48cGF0aCBkPSJNMjQ1Ljk3IDE2OC45NDNjLTEzLjY2MiA3LjEyMS04NC40MzQgMzYuMjItOTkuNTAxIDQ0LjA3NS0xNS4wNjcgNy44NTYtMjMuNDM3IDcuNzgtMzUuMzQgMi4wOS0xMS45MDItNS42OS04Ny4yMTYtMzYuMTEyLTEwMC43ODMtNDIuNTk3QzMuNTY2IDE2OS4yNzEgMCAxNjYuNTM1IDAgMTYzLjk1MXYtMjUuODc2czk4LjA1LTIxLjM0NSA [...]
+spec:
+  definition:
+    title: "Redis Sink"
+    description: "Write object to a Redis cache."
+    required:
+      - redisHost
+      - redisPort
+      - command
+    type: object
+    properties:
+      redisHost:
+        title: Redis Host
+        description: The host where Redis server is running
+        type: string
+      redisPort:
+        title: Redis Port
+        description: The port where Redis server is running
+        type: integer
+      command:
+        title: Command
+        description: Redis Command 
+        type: string
+        default: GET
+      channels:
+        title: Channels
+        description: Redis Channels
+        type: string
+        default: one
+      serializer:
+        title: Serializer
+        description: RedisSerializer fully qualified name implementation 
+        type: string
+        default: org.springframework.data.redis.serializer.StringRedisSerializer
+  dependencies:
+    - "camel:kamelet"
+    - "camel:core"
+    - "camel:spring-redis"
+  flow:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[key]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Key
+                simple: "${header[key]}"
+          - simple: "${header[ce-key]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Key
+                simple: "${header[ce-key]}"
+      - choice:
+          when:
+          - simple: "${header[value]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Value
+                simple: "${header[value]}"
+          - simple: "${header[ce-value]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Value
+                simple: "${header[ce-value]}"
+      - choice:
+          when:
+          - simple: "${header[message]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Message
+                simple: "${header[message]}"
+          - simple: "${header[ce-message]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Message
+                simple: "${header[ce-message]}"
+      - choice:
+          when:
+          - simple: "${header[channel]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Channel
+                simple: "${header[channel]}"
+          - simple: "${header[ce-channel]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Channel
+                simple: "${header[ce-channell]}"
+      - set-header:
+          name: CamelRedis.Message
+          simple: "${body}"
+      - set-header:
+          name: CamelRedis.Value
+          simple: "${body}"
+      - to:
+          uri: "spring-redis:{{redisHost}}:{{redisPort}}"
+          parameters:
+            command: "{{command}}"
+            channels: "{{channels}}"
+            serializer: "#class:{{serializer}}"
\ No newline at end of file
diff --git a/library/camel-kamelets/src/main/resources/kamelets/redis-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/redis-sink.kamelet.yaml
new file mode 100644
index 0000000..017dcf9
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/redis-sink.kamelet.yaml
@@ -0,0 +1,129 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: redis-sink
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+  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: "Redis"
+    camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMTQ4IiB2aWV3Qm94PSIwIDAgMjU2IDIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij48cGF0aCBkPSJNMjQ1Ljk3IDE2OC45NDNjLTEzLjY2MiA3LjEyMS04NC40MzQgMzYuMjItOTkuNTAxIDQ0LjA3NS0xNS4wNjcgNy44NTYtMjMuNDM3IDcuNzgtMzUuMzQgMi4wOS0xMS45MDItNS42OS04Ny4yMTYtMzYuMTEyLTEwMC43ODMtNDIuNTk3QzMuNTY2IDE2OS4yNzEgMCAxNjYuNTM1IDAgMTYzLjk1MXYtMjUuODc2czk4LjA1LTIxLjM0NSA [...]
+spec:
+  definition:
+    title: "Redis Sink"
+    description: "Write object to a Redis cache."
+    required:
+      - redisHost
+      - redisPort
+      - command
+    type: object
+    properties:
+      redisHost:
+        title: Redis Host
+        description: The host where Redis server is running
+        type: string
+      redisPort:
+        title: Redis Port
+        description: The port where Redis server is running
+        type: integer
+      command:
+        title: Command
+        description: Redis Command 
+        type: string
+        default: GET
+      channels:
+        title: Channels
+        description: Redis Channels
+        type: string
+        default: one
+      serializer:
+        title: Serializer
+        description: RedisSerializer fully qualified name implementation 
+        type: string
+        default: org.springframework.data.redis.serializer.StringRedisSerializer
+  dependencies:
+    - "camel:kamelet"
+    - "camel:core"
+    - "camel:spring-redis"
+  flow:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[key]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Key
+                simple: "${header[key]}"
+          - simple: "${header[ce-key]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Key
+                simple: "${header[ce-key]}"
+      - choice:
+          when:
+          - simple: "${header[value]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Value
+                simple: "${header[value]}"
+          - simple: "${header[ce-value]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Value
+                simple: "${header[ce-value]}"
+      - choice:
+          when:
+          - simple: "${header[message]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Message
+                simple: "${header[message]}"
+          - simple: "${header[ce-message]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Message
+                simple: "${header[ce-message]}"
+      - choice:
+          when:
+          - simple: "${header[channel]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Channel
+                simple: "${header[channel]}"
+          - simple: "${header[ce-channel]}"
+            steps:
+            - set-header:
+                name: CamelRedis.Channel
+                simple: "${header[ce-channell]}"
+      - set-header:
+          name: CamelRedis.Message
+          simple: "${body}"
+      - set-header:
+          name: CamelRedis.Value
+          simple: "${body}"
+      - to:
+          uri: "spring-redis:{{redisHost}}:{{redisPort}}"
+          parameters:
+            command: "{{command}}"
+            channels: "{{channels}}"
+            serializer: "#class:{{serializer}}"
\ No newline at end of file
diff --git a/templates/bindings/camel-k/redis-sink-binding.yaml b/templates/bindings/camel-k/redis-sink-binding.yaml
new file mode 100644
index 0000000..b319cc1
--- /dev/null
+++ b/templates/bindings/camel-k/redis-sink-binding.yaml
@@ -0,0 +1,19 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: redis-sink-binding
+spec:
+  source:
+    ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  sink:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: redis-sink
+    properties:
+      redisHost: "The Redis Host"
+      redisPort: "The Redis Port"
+  
\ No newline at end of file
diff --git a/templates/bindings/core/redis-sink-binding.yaml b/templates/bindings/core/redis-sink-binding.yaml
new file mode 100644
index 0000000..2673c30
--- /dev/null
+++ b/templates/bindings/core/redis-sink-binding.yaml
@@ -0,0 +1,13 @@
+- route:
+    from:
+      uri: "kamelet:timer-source"
+      parameters:
+        period: 1000
+        message: "Hello Camel JBang"
+    steps:
+      - to:
+          uri: "kamelet:redis-sink"
+          parameters:
+            redisHost: "The Redis Host"
+            redisPort: "The Redis Port"
+    
\ No newline at end of file