You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/08/22 03:29:52 UTC

[camel-k-examples] 07/10: improve KameletBindings example

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

tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k-examples.git

commit 9f571499e468871b103cda2f99d3384607e963d3
Author: Kuthumi Pepple <ku...@gmail.com>
AuthorDate: Fri Aug 19 22:48:55 2022 +0100

    improve KameletBindings example
---
 .../kamelets/kameletbindings/README.md             | 39 ++++++++++++++++++++++
 .../kamelets/kameletbindings/kb-env-vars.yaml      |  2 +-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/generic-examples/kamelets/kameletbindings/README.md b/generic-examples/kamelets/kameletbindings/README.md
index 9e2ba04..487c721 100644
--- a/generic-examples/kamelets/kameletbindings/README.md
+++ b/generic-examples/kamelets/kameletbindings/README.md
@@ -1,3 +1,42 @@
 # KameletBindings examples
 
 Find useful examples about how to use KameletBindings.
+
+## Understanding the examples
+- [env-var-writer.kamelet.yaml](./env-var-writer.kamelet.yaml): sink kamelet, logs specified env variables.
+- [kb-env-vars.yaml](./kb-env-vars.yaml): kamelet binding, connects the _env-var-writer_ kamelet directly to a Camel URI, adds env variables to the integration container using the `environment` trait.
+- [kb-log-trait-annotation.yaml](./kb-log-trait-annotation.yaml): kamelet binding, connects two Camel URIs, uses the `logging` trait to customize the integration behaviour.
+
+## Running the examples
+### Timer-to-Log kamelet binding
+First, we apply the kamelet used in this binding:
+```
+kubectl apply -f env-var-writer.kamelet.yaml
+```
+
+Next, we apply the kamelet binding
+```
+kubectl apply -f kb-env-vars.yaml
+```
+A _timer-to-log_ integration is created that implements the binding. To view the logs, run:
+```
+kamel log timer-to-log
+...
+[1] 2022-08-18 22:25:22,083 INFO  [bar] (Camel (camel-1) thread #1 - timer://foo) Exchange[ExchangePattern: InOnly, BodyType: String, Body: value1 / value2]
+[1] 2022-08-18 22:25:23,083 INFO  [bar] (Camel (camel-1) thread #1 - timer://foo) Exchange[ExchangePattern: InOnly, BodyType: String, Body: value1 / value2]
+...
+```
+
+### Timer-2-Log-Annotation kamelet binding
+Apply the kamelet binding:
+```
+kubectl apply -f kb-log-trait-annotation.yaml
+```
+A _timer-2-log-annotation_ integration is created that implements the binding. You should see information logged at the `DEBUG` level. The messages should NOT use color. To view the logs:
+```
+kamel log timer-2-log-annotation
+...
+[1] 2022-08-19 12:38:46,871 DEBUG [org.apa.cam.pro.SendProcessor] (Camel (camel-1) thread #1 - timer://foo) >>>> log://bar Exchange[]
+[1] 2022-08-19 12:38:46,871 INFO  [bar] (Camel (camel-1) thread #1 - timer://foo) Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]]
+...
+```
diff --git a/generic-examples/kamelets/kameletbindings/kb-env-vars.yaml b/generic-examples/kamelets/kameletbindings/kb-env-vars.yaml
index 4ce9e5a..c0b8bc6 100644
--- a/generic-examples/kamelets/kameletbindings/kb-env-vars.yaml
+++ b/generic-examples/kamelets/kameletbindings/kb-env-vars.yaml
@@ -19,7 +19,7 @@
 # kubectl apply -f env-var-writer.kamelet.yaml
 #
 # Apply kamelet binding
-# kubect apply -f kb-env-vars.yaml
+# kubectl apply -f kb-env-vars.yaml
 # 
 apiVersion: camel.apache.org/v1alpha1
 kind: KameletBinding