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:22 UTC

[camel-kamelets] 06/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 97e50e0d75838e884159192537fad534108ed9c6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Nov 25 15:04:01 2021 +0100

    Added Infinispan Sink Kamelet
---
 docs/modules/ROOT/pages/infinispan-sink.adoc       | 40 +++++++++++-----------
 .../bindings/camel-k/infinispan-sink-binding.yaml  | 10 +++---
 .../bindings/core/infinispan-sink-binding.yaml     | 15 ++++----
 3 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/docs/modules/ROOT/pages/infinispan-sink.adoc b/docs/modules/ROOT/pages/infinispan-sink.adoc
index e471a21..cfdadf5 100644
--- a/docs/modules/ROOT/pages/infinispan-sink.adoc
+++ b/docs/modules/ROOT/pages/infinispan-sink.adoc
@@ -45,9 +45,9 @@ At runtime, the `infinispan-sink` Kamelet relies upon the presence of the follow
 
 This section describes how you can use the `infinispan-sink`.
 
-=== Knative Source
+=== Knative Sink
 
-You can use the `infinispan-sink` Kamelet as a Knative source by binding it to a Knative object.
+You can use the `infinispan-sink` Kamelet as a Knative sink by binding it to a Knative object.
 
 .infinispan-sink-binding.yaml
 [source,yaml]
@@ -59,6 +59,11 @@ metadata:
 spec:
   source:
     ref:
+      kind: Channel
+      apiVersion: messaging.knative.dev/v1
+      name: mychannel
+  sink:
+    ref:
       kind: Kamelet
       apiVersion: camel.apache.org/v1alpha1
       name: infinispan-sink
@@ -67,11 +72,6 @@ spec:
       hosts: "The Hosts"
       password: "The Password"
       username: "The Username"
-  sink:
-    ref:
-      kind: Channel
-      apiVersion: messaging.knative.dev/v1
-      name: mychannel
   
 ----
 
@@ -83,7 +83,7 @@ You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K
 
 . Save the `infinispan-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
 
-. Run the source by using the following command:
+. Run the sink by using the following command:
 +
 [source,shell]
 ----
@@ -92,18 +92,18 @@ kubectl apply -f infinispan-sink-binding.yaml
 
 ==== *Procedure for using the Kamel CLI*
 
-Configure and run the source by using the following command:
+Configure and run the sink by using the following command:
 
 [source,shell]
 ----
-kamel bind infinispan-sink -p "source.cacheName=The Cache Name" -p "source.hosts=The Hosts" -p "source.password=The Password" -p "source.username=The Username" channel:mychannel
+kamel bind channel:mychannel infinispan-sink -p "sink.cacheName=The Cache Name" -p "sink.hosts=The Hosts" -p "sink.password=The Password" -p "sink.username=The Username"
 ----
 
 This command creates the KameletBinding in the current namespace on the cluster.
 
-=== Kafka Source
+=== Kafka Sink
 
-You can use the `infinispan-sink` Kamelet as a Kafka source by binding it to a Kafka topic.
+You can use the `infinispan-sink` Kamelet as a Kafka sink by binding it to a Kafka topic.
 
 .infinispan-sink-binding.yaml
 [source,yaml]
@@ -115,6 +115,11 @@ metadata:
 spec:
   source:
     ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  sink:
+    ref:
       kind: Kamelet
       apiVersion: camel.apache.org/v1alpha1
       name: infinispan-sink
@@ -123,11 +128,6 @@ spec:
       hosts: "The Hosts"
       password: "The Password"
       username: "The Username"
-  sink:
-    ref:
-      kind: KafkaTopic
-      apiVersion: kafka.strimzi.io/v1beta1
-      name: my-topic
   
 ----
 
@@ -141,7 +141,7 @@ spec:
 
 . Save the `infinispan-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
 
-. Run the source by using the following command:
+. Run the sink by using the following command:
 +
 [source,shell]
 ----
@@ -150,11 +150,11 @@ kubectl apply -f infinispan-sink-binding.yaml
 
 ==== *Procedure for using the Kamel CLI*
 
-Configure and run the source by using the following command:
+Configure and run the sink by using the following command:
 
 [source,shell]
 ----
-kamel bind infinispan-sink -p "source.cacheName=The Cache Name" -p "source.hosts=The Hosts" -p "source.password=The Password" -p "source.username=The Username" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
+kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic infinispan-sink -p "sink.cacheName=The Cache Name" -p "sink.hosts=The Hosts" -p "sink.password=The Password" -p "sink.username=The Username"
 ----
 
 This command creates the KameletBinding in the current namespace on the cluster.
diff --git a/templates/bindings/camel-k/infinispan-sink-binding.yaml b/templates/bindings/camel-k/infinispan-sink-binding.yaml
index b949014..075417f 100644
--- a/templates/bindings/camel-k/infinispan-sink-binding.yaml
+++ b/templates/bindings/camel-k/infinispan-sink-binding.yaml
@@ -5,6 +5,11 @@ metadata:
 spec:
   source:
     ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  sink:
+    ref:
       kind: Kamelet
       apiVersion: camel.apache.org/v1alpha1
       name: infinispan-sink
@@ -13,9 +18,4 @@ spec:
       hosts: "The Hosts"
       password: "The Password"
       username: "The Username"
-  sink:
-    ref:
-      kind: KafkaTopic
-      apiVersion: kafka.strimzi.io/v1beta1
-      name: my-topic
   
\ No newline at end of file
diff --git a/templates/bindings/core/infinispan-sink-binding.yaml b/templates/bindings/core/infinispan-sink-binding.yaml
index 939e1dd..2b9b88e 100644
--- a/templates/bindings/core/infinispan-sink-binding.yaml
+++ b/templates/bindings/core/infinispan-sink-binding.yaml
@@ -1,12 +1,15 @@
 - route:
     from:
-      uri: "kamelet:infinispan-sink"
+      uri: "kamelet:timer-source"
       parameters:
-        cacheName: "The Cache Name"
-        hosts: "The Hosts"
-        password: "The Password"
-        username: "The Username"
+        period: 1000
+        message: "Hello Camel JBang"
     steps:
       - to:
-          uri: "log:info"
+          uri: "kamelet:infinispan-sink"
+          parameters:
+            cacheName: "The Cache Name"
+            hosts: "The Hosts"
+            password: "The Password"
+            username: "The Username"
     
\ No newline at end of file