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 2023/10/10 13:12:44 UTC

[camel-kamelets-examples] branch main updated: Added an example of Apicurio Registry Usage with Kafka through YAML - Show we can do the same with a 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-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new ee68442  Added an example of Apicurio Registry Usage with Kafka through YAML - Show we can do the same with a Kamelet
ee68442 is described below

commit ee68442fc86583bdc37b8bb17dc661b0be5aaac8
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Oct 10 15:12:13 2023 +0200

    Added an example of Apicurio Registry Usage with Kafka through YAML - Show we can do the same with a Kamelet
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 jbang/kafka-apicurio-schema-registry/README.md     | 12 ++++++-
 .../kafka-apicurio-kamelet.yaml                    | 39 ++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/jbang/kafka-apicurio-schema-registry/README.md b/jbang/kafka-apicurio-schema-registry/README.md
index 5864390..e0af776 100644
--- a/jbang/kafka-apicurio-schema-registry/README.md
+++ b/jbang/kafka-apicurio-schema-registry/README.md
@@ -26,7 +26,7 @@ Run [`Produce.java`](./kafka-producer/src/main/java/com/acme/example/kafka/Produ
 mvn compile exec:java -Dexec.mainClass="com.acme.example.kafka.Produce"
 ```
 
-## Consume from Kafka.
+## Consume from Kafka without Kamelets
 
 To consume messages using a Camel route, first install the kafka-producer maven project:
 ```bash
@@ -78,4 +78,14 @@ and after a message has been produced to Kafka you should see
 ]
 ```
 
+## Consume from Kafka with Kamelets
+
+You might also want to try out the specialized Kamelet for Apicurio Registry
+
+Follow the same approach but run
+
+then run:
+```bash
+jbang run camel@apache/camel run --local-kamelet-dir=<local_path_to_camel_kamelets> --kamelets-version=4.1.0-SNAPSHOT kafka-apicurio-kamelet.yaml
+```
 
diff --git a/jbang/kafka-apicurio-schema-registry/kafka-apicurio-kamelet.yaml b/jbang/kafka-apicurio-schema-registry/kafka-apicurio-kamelet.yaml
new file mode 100644
index 0000000..0938579
--- /dev/null
+++ b/jbang/kafka-apicurio-schema-registry/kafka-apicurio-kamelet.yaml
@@ -0,0 +1,39 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# camel-k: dependency=mvn:com.acme.example:kafka-apicurio-producer:0.1
+
+- beans:
+  - name: order
+    type: "#class:com.acme.example.kafka.models.Order"
+
+- route:
+    id: "kafka-to-apicurio-log"
+    from:
+      uri: "kamelet:kafka-apicurio-registry-not-secured-source"
+      parameters:
+        topic: "{{topic}}"
+        bootstrapServers: "{{bootstrap.servers}}"
+        groupId: 'my-consumer-group'
+        apicurioRegistryUrl: '{{schema.registry.url}}'
+      steps:
+        - to:
+            uri: "kamelet:log-sink"
+            parameters:
+              showStreams: true
+              showHeaders: true
+              multiline: true