Skip to content

Commit

Permalink
Add Redis source kamelet
Browse files Browse the repository at this point in the history
  • Loading branch information
Croway committed Dec 3, 2021
1 parent 46ddaf5 commit 0db53fc
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/kamelets/redis-source.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
153 changes: 153 additions & 0 deletions docs/modules/ROOT/pages/redis-source.adoc
Original file line number Diff line number Diff line change
@@ -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
74 changes: 74 additions & 0 deletions kamelets/redis-source.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -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,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIyMTQ4IiB2aWV3Qm94PSIwIDAgMjU2IDIyMCIgeG1sbnM9Imh0dHA6Ly93d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zJNNzQuMDgyIDM5LjM0N2MxNy4zNzUgMCAzMS40NiA1LjQ2IDMxLjQ2IDEyLjE5NCAwIDYuNzM2LTE0LjA4NSAxMi4xOTUtMzEuNDYgMTIuMTk1cy0zMS40Ni01LjQ2LTMxLjQ2LTEyLjE5NWMwLTYuNzM0IDE0LjA4NS0xMi4xOTQgMzEuNDYtMTIuMTk0IiBmaWxsPSIjRkZGIi8+PHBhdGggZD0iTTE4NS4yOTUgMzUuOTk4bDM0LjgzNiAxMy43NjYtMzQuODA2IDEzLjc1My0uMDMtMjcuNTIiIGZpbGw9IiM2MjFCMUMiLz48cGF0aCBkPSJNMTQ2Ljc1NSA1MS4yNDNsMzguNTQtMTUuMjQ1LjAzIDI3LjUxOS0zLjc3OSAxLjQ3OC0zNC43OTEtMTMuNzUyIiBmaWxsPSIjOUEyOTI4Ii8+PC9zdmc+
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
Loading

0 comments on commit 0db53fc

Please sign in to comment.