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 08:58:21 UTC

[camel-kamelets] branch main updated: Add Redis source kamelet

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


The following commit(s) were added to refs/heads/main by this push:
     new fb043d7  Add Redis source kamelet
fb043d7 is described below

commit fb043d76f78d298d1e7b9f01f03ffeb8103c0bf8
Author: Federico Mariani <fe...@gmail.com>
AuthorDate: Fri Dec 3 17:11:20 2021 +0100

    Add Redis source kamelet
---
 .../ROOT/assets/images/kamelets/redis-source.svg   |   1 +
 docs/modules/ROOT/nav.adoc                         |   1 +
 docs/modules/ROOT/pages/redis-source.adoc          | 153 +++++++++++++++++++++
 kamelets/redis-source.kamelet.yaml                 |  74 ++++++++++
 .../resources/kamelets/redis-source.kamelet.yaml   |  74 ++++++++++
 .../bindings/camel-k/redis-source-binding.yaml     |  19 +++
 templates/bindings/core/redis-source-binding.yaml  |  10 ++
 7 files changed, 332 insertions(+)

diff --git a/docs/modules/ROOT/assets/images/kamelets/redis-source.svg b/docs/modules/ROOT/assets/images/kamelets/redis-source.svg
new file mode 100644
index 0000000..313e8bc
--- /dev/null
+++ b/docs/modules/ROOT/assets/images/kamelets/redis-source.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 50a6bf5..c94f9f2 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-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]
 * xref:ROOT:salesforce-source.adoc[image:kamelets/salesforce-source.svg[] Salesforce Source]
diff --git a/docs/modules/ROOT/pages/redis-source.adoc b/docs/modules/ROOT/pages/redis-source.adoc
new file mode 100644
index 0000000..ddb6bed
--- /dev/null
+++ b/docs/modules/ROOT/pages/redis-source.adoc
@@ -0,0 +1,153 @@
+// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
+
+= image:kamelets/redis-source.svg[] Redis Source
+
+*Provided by: "Apache Software Foundation"*
+
+*Support Level for this Kamelet is: "Preview"*
+
+Get Events from a Redis cache
+
+== Configuration Options
+
+The following table summarizes the configuration options available for the `redis-source` Kamelet:
+[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
+|===
+| Property| Name| Description| Type| Default| Example
+| *channels {empty}* *| Channels| Redis Channels| string| `"one"`| 
+| *redisHost {empty}* *| Redis Host| The host where Redis server is running| string| | 
+| *redisPort {empty}* *| Redis Port| The port where Redis server is running| integer| | 
+| command| Command| Redis Command| string| `"SUBSCRIBE"`| 
+| 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-source` 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-source`.
+
+=== Knative Source
+
+You can use the `redis-source` Kamelet as a Knative source by binding it to a Knative object.
+
+.redis-source-binding.yaml
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: redis-source-binding
+spec:
+  source:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: redis-source
+    properties:
+      redisHost: "The Redis Host"
+      redisPort: "The Redis Port"
+  sink:
+    ref:
+      kind: Channel
+      apiVersion: messaging.knative.dev/v1
+      name: mychannel
+  
+----
+
+==== *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-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
+
+. Run the source by using the following command:
++
+[source,shell]
+----
+kubectl apply -f redis-source-binding.yaml
+----
+
+==== *Procedure for using the Kamel CLI*
+
+Configure and run the source by using the following command:
+
+[source,shell]
+----
+kamel bind redis-source -p "source.redisHost=The Redis Host" -p "source.redisPort=The Redis Port" channel:mychannel
+----
+
+This command creates the KameletBinding in the current namespace on the cluster.
+
+=== Kafka Source
+
+You can use the `redis-source` Kamelet as a Kafka source by binding it to a Kafka topic.
+
+.redis-source-binding.yaml
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: redis-source-binding
+spec:
+  source:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: redis-source
+    properties:
+      redisHost: "The Redis Host"
+      redisPort: "The Redis Port"
+  sink:
+    ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  
+----
+
+==== *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-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
+
+. Run the source by using the following command:
++
+[source,shell]
+----
+kubectl apply -f redis-source-binding.yaml
+----
+
+==== *Procedure for using the Kamel CLI*
+
+Configure and run the source by using the following command:
+
+[source,shell]
+----
+kamel bind redis-source -p "source.redisHost=The Redis Host" -p "source.redisPort=The Redis Port" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
+----
+
+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-source.kamelet.yaml
+
+// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
diff --git a/kamelets/redis-source.kamelet.yaml b/kamelets/redis-source.kamelet.yaml
new file mode 100644
index 0000000..300babf
--- /dev/null
+++ b/kamelets/redis-source.kamelet.yaml
@@ -0,0 +1,74 @@
+# ---------------------------------------------------------------------------
+# 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-source
+  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: "Redis"
+    camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMTQ4IiB2aWV3Qm94PSIwIDAgMjU2IDIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij48cGF0aCBkPSJNMjQ1Ljk3IDE2OC45NDNjLTEzLjY2MiA3LjEyMS04NC40MzQgMzYuMjItOTkuNTAxIDQ0LjA3NS0xNS4wNjcgNy44NTYtMjMuNDM3IDcuNzgtMzUuMzQgMi4wOS0xMS45MDItNS42OS04Ny4yMTYtMzYuMTEyLTEwMC43ODMtNDIuNTk3QzMuNTY2IDE2OS4yNzEgMCAxNjYuNTM1IDAgMTYzLjk1MXYtMjUuODc2czk4LjA1LTIxLjM0NSA [...]
+spec:
+  definition:
+    title: "Redis Source"
+    description: "Get Events from a Redis cache"
+    required:
+      - redisHost
+      - redisPort
+      - channels
+    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: SUBSCRIBE
+      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: "spring-redis:{{redisHost}}:{{redisPort}}"
+      parameters:
+        command: "{{command}}"
+        channels: "{{channels}}"
+        serializer: "#class:{{serializer}}"
+      steps:
+      - to: kamelet:sink
diff --git a/library/camel-kamelets/src/main/resources/kamelets/redis-source.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/redis-source.kamelet.yaml
new file mode 100644
index 0000000..e7a1cf6
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/redis-source.kamelet.yaml
@@ -0,0 +1,74 @@
+# ---------------------------------------------------------------------------
+# 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-source
+  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: "Redis"
+    camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMTQ4IiB2aWV3Qm94PSIwIDAgMjU2IDIyMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij48cGF0aCBkPSJNMjQ1Ljk3IDE2OC45NDNjLTEzLjY2MiA3LjEyMS04NC40MzQgMzYuMjItOTkuNTAxIDQ0LjA3NS0xNS4wNjcgNy44NTYtMjMuNDM3IDcuNzgtMzUuMzQgMi4wOS0xMS45MDItNS42OS04Ny4yMTYtMzYuMTEyLTEwMC43ODMtNDIuNTk3QzMuNTY2IDE2OS4yNzEgMCAxNjYuNTM1IDAgMTYzLjk1MXYtMjUuODc2czk4LjA1LTIxLjM0NSA [...]
+spec:
+  definition:
+    title: "Redis Source"
+    description: "Get Events from a Redis cache"
+    required:
+      - redisHost
+      - redisPort
+      - channels
+    type: object
+    properties:
+      rediHost:
+        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: SUBSCRIBE
+      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: "spring-redis:{{redisHost}}:{{redisPort}}"
+      parameters:
+        command: "{{command}}"
+        channels: "{{channels}}"
+        serializer: "#class:{{serializer}}"
+      steps:
+      - to: kamelet:sink
diff --git a/templates/bindings/camel-k/redis-source-binding.yaml b/templates/bindings/camel-k/redis-source-binding.yaml
new file mode 100644
index 0000000..a77f052
--- /dev/null
+++ b/templates/bindings/camel-k/redis-source-binding.yaml
@@ -0,0 +1,19 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: redis-source-binding
+spec:
+  source:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: redis-source
+    properties:
+      redisHost: "The Redis Host"
+      redisPort: "The Redis Port"
+  sink:
+    ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  
\ No newline at end of file
diff --git a/templates/bindings/core/redis-source-binding.yaml b/templates/bindings/core/redis-source-binding.yaml
new file mode 100644
index 0000000..fb7eba4
--- /dev/null
+++ b/templates/bindings/core/redis-source-binding.yaml
@@ -0,0 +1,10 @@
+- route:
+    from:
+      uri: "kamelet:redis-source"
+      parameters:
+        redisHost: "The Redis Host"
+        redisPort: "The Redis Port"
+    steps:
+      - to:
+          uri: "log:info"
+    
\ No newline at end of file