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

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

commit 81c568f5b556a91852b2943d4a6dacb986bf01d3
Author: Zineb Bendhiba <[email protected]>
AuthorDate: Thu Jun 3 17:27:34 2021 +0200

    Kafka example
    Fixes #1028
---
 .github/test-categories.yaml                       |   2 +
 docs/modules/ROOT/attachments/examples.json        |   5 +
 file-bindy-ftp/pom.xml                             |   2 +-
 file-split-log-xml/pom.xml                         |   2 +-
 health/pom.xml                                     |   2 +-
 http-log/pom.xml                                   |   2 +-
 kafka/README.adoc                                  | 159 +++++++++++++++++++++
 kafka/conf/docker-compose.yaml                     |  47 ++++++
 {file-bindy-ftp => kafka}/pom.xml                  |  58 ++++----
 kafka/src/main/docker/Dockerfile.jvm               |  71 +++++++++
 kafka/src/main/docker/Dockerfile.native            |  44 ++++++
 .../org/apache/camel/example/KafkaResource.java    |  37 +++++
 .../main/java/org/apache/camel/example/Routes.java |  41 ++++++
 kafka/src/main/resources/application.properties    |  74 ++++++++++
 .../java/org/apache/camel/example/KafkaIT.java     |  23 +++
 .../java/org/apache/camel/example/KafkaTest.java   |  37 +++++
 .../apache/camel/example/StrimziTestResource.java  |  49 +++++++
 observability/pom.xml                              |   2 +-
 rest-json/pom.xml                                  |   2 +-
 timer-log-cdi/pom.xml                              |   2 +-
 timer-log-kotlin/pom.xml                           |   2 +-
 timer-log-main/pom.xml                             |   2 +-
 timer-log-spring/pom.xml                           |   2 +-
 timer-log-xml/pom.xml                              |   2 +-
 timer-log/pom.xml                                  |   2 +-
 25 files changed, 631 insertions(+), 40 deletions(-)

diff --git a/.github/test-categories.yaml b/.github/test-categories.yaml
index e4d3cec..4cb1c7f 100644
--- a/.github/test-categories.yaml
+++ b/.github/test-categories.yaml
@@ -35,3 +35,5 @@ group-05:
 group-06:
   - timer-log-spring
   - timer-log-xml
+examples-other:
+  - kafka
\ No newline at end of file
diff --git a/docs/modules/ROOT/attachments/examples.json 
b/docs/modules/ROOT/attachments/examples.json
index 24389e4..4116641 100644
--- a/docs/modules/ROOT/attachments/examples.json
+++ b/docs/modules/ROOT/attachments/examples.json
@@ -25,6 +25,11 @@
     "link": "https://github.com/apache/camel-quarkus-examples/tree/main/health";
   },
   {
+    "title": "Kafka example ",
+    "description": "Shows how to produce and consume messages in a Kafka 
topic",
+    "link": "https://github.com/apache/camel-quarkus-examples/tree/main/kafka";
+  },
+  {
     "title": "Kotlin Hello World",
     "description": "Shows how to define Camel routes using Kotlin programming 
language",
     "link": 
"https://github.com/apache/camel-quarkus-examples/tree/main/timer-log-kotlin";
diff --git a/file-bindy-ftp/pom.xml b/file-bindy-ftp/pom.xml
index a77f93f..401d634 100644
--- a/file-bindy-ftp/pom.xml
+++ b/file-bindy-ftp/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/file-split-log-xml/pom.xml b/file-split-log-xml/pom.xml
index 07c19eb..d22cc9a 100644
--- a/file-split-log-xml/pom.xml
+++ b/file-split-log-xml/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/health/pom.xml b/health/pom.xml
index 99ee0bc..6945646 100644
--- a/health/pom.xml
+++ b/health/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/http-log/pom.xml b/http-log/pom.xml
index 5300100..daf5c1b 100644
--- a/http-log/pom.xml
+++ b/http-log/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/kafka/README.adoc b/kafka/README.adoc
new file mode 100644
index 0000000..9e61b10
--- /dev/null
+++ b/kafka/README.adoc
@@ -0,0 +1,159 @@
+= Kafka example : A Camel Quarkus example
+:cq-example-description: An example that shows how to produce and consume 
messages in a Kafka topic
+
+{cq-description}
+
+TIP: Check the 
https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus 
User guide] for prerequisites
+and other general information.
+
+
+== Prerequisites
+
+The example application requires a running Kafka instance. For simplicity, you 
can launch the Kafka instance using the docker-compose.yaml.
+
+----
+$ cd conf && docker-compose up
+----
+
+Next : uncomment the The section Kafka instance without Authentication in 
`src/main/resources/application.properties` and set :
+----
+camel.component.kafka.brokers=localhost:9092
+----
+
+If you prefer to use a different Kafka instance uncomment and adjust the 
corresponding commented section in `src/main/resources/application.properties`.
+
+- The section Kafka instance without Authentication if no Authentication 
required.
+- The section Kafka instance with SASL Plain is using SASL.
+- The section Kafka instance with SASL Oauth Bearer if using Oauth Bearer.
+
+== Start in Development mode
+
+Run the application in development mode.
+
+[source,shell]
+----
+$ mvn clean compile quarkus:dev
+----
+
+The above command compiles the project, starts the application and lets the 
Quarkus tooling watch for changes in your
+workspace. Any modifications in your project will automatically take effect in 
the running application.
+
+TIP: Please refer to the Development mode section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel
 Quarkus User guide] for more details.
+
+You should start to see some log messages appearing on the console.
+
+Every 10 seconds the timer component triggers the generation of random Message 
and send it to the Kafka topic `Test`.
+
+[source,shell]
+----
+[FromTimer2Kafka] (Camel (camel-1) thread #2 - KafkaProducer[test]) Message 
sent correctly sent to the topic! : "Message #1"
+----
+
+Next a Kafka consumer reads the messages and put them in a seda queue.
+
+[source,shell]
+----
+[FromKafka2Seda] (Camel (camel-1) thread #0 - KafkaConsumer[test]) Received : 
"Message #1"
+----
+
+Next pull a message from the queue :
+[source,shell]
+----
+$ curl -X GET http://0.0.0.0:8080/example
+----
+
+
+=== Package and run the application
+
+Once you are done with developing you may want to package and run the 
application.
+
+TIP: Find more details about the JVM mode and Native mode in the Package and 
run section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel
 Quarkus User guide]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package -DskipTests
+$ java -jar target/quarkus-app/quarkus-run.jar
+----
+
+==== Native mode
+
+IMPORTANT: Native mode requires having GraalVM and other tools installed. 
Please check the Prerequisites section
+of 
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_prerequisites[Camel
 Quarkus User guide].
+
+To prepare a native executable using GraalVM, run the following command:
+
+[source,shell]
+----
+$ mvn clean package -DskipTests -Pnative
+$ ./target/*-runner
+----
+
+==== Deploying to Kubernetes
+
+You can build a container image for the application like this. Refer to the 
https://quarkus.io/guides/deploying-to-kubernetes[Quarkus Kubernetes guide] for 
options around customizing image names, registries etc.
+
+Uncomment the container build section. Set the proper image group.
+
+[source,shell]
+----
+$ mvn clean package -DskipTests
+----
+
+If you are using a local development cluster like Kind or k3s, you can use 
host the container image on your local host. Or, with minikube, use the Docker 
daemon from the cluster virtual machine `eval $(minikube docker-env)`. 
Otherwise, you'll need to push the image to a registry of your choosing.
+
+TIP: You can build & deploy in one single step by doing `mvn clean package 
-DskipTests -Dquarkus.kubernetes.deploy=true`
+
+Check pods are running.
+
+Example when using Strimzi operator, with a Kafka instance named `Test` :
+
+[source,shell]
+----
+$ kubectl get pods
+NAME                                           READY   STATUS    RESTARTS   AGE
+camel-quarkus-examples-kafka-dbc56974b-ph29m   1/1     Running   0          
2m34s
+test-entity-operator-7cccff5899-dlfx8          3/3     Running   0          48m
+test-kafka-0                                   1/1     Running   0          49m
+test-kafka-1                                   1/1     Running   0          49m
+test-kafka-2                                   1/1     Running   0          49m
+test-zookeeper-0                               1/1     Running   0          50m
+test-zookeeper-1                               1/1     Running   0          50m
+test-zookeeper-2                               1/1     Running   0          50m
+
+----
+
+Tail the application logs.
+
+[source,shell]
+----
+$ kubectl logs -f camel-quarkus-examples-kafka-dbc56974b-ph29m
+----
+
+To clean up do.
+
+[source,shell]
+----
+$ kubectl delete all -l app.kubernetes.io/name=camel-quarkus-examples-kafka
+----
+
+[NOTE]
+====
+If you need to configure container resource limits & requests, or enable the 
Quarkus Kubernetes client to trust self signed certificates, you can find these 
configuration options in `src/main/resources/application.properties`. Simply 
uncomment them and set your desired values.
+====
+
+==== Deploying to OpenShift
+
+[source,shell]
+----
+$ mvn clean package -DskipTests -Dquarkus.kubernetes.deploy=true -Dopenshift
+----
+
+You can check the pod status and tail logs using the commands mentioned above 
in the Kubernetes section. Use the `oc` binary instead of `kubectl` if 
preferred.
+
+== Feedback
+
+Please report bugs and propose improvements via 
https://github.com/apache/camel-quarkus/issues[GitHub issues of Camel Quarkus] 
project.
diff --git a/kafka/conf/docker-compose.yaml b/kafka/conf/docker-compose.yaml
new file mode 100644
index 0000000..de99cae
--- /dev/null
+++ b/kafka/conf/docker-compose.yaml
@@ -0,0 +1,47 @@
+#
+# 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.
+#
+
+version: '2'
+
+services:
+
+  zookeeper:
+    image: quay.io/strimzi/kafka:0.21.1-kafka-2.7.0
+    command: [
+        "sh", "-c",
+        "bin/zookeeper-server-start.sh config/zookeeper.properties"
+    ]
+    ports:
+      - "2181:2181"
+    environment:
+      LOG_DIR: /tmp/logs
+
+  kafka:
+    image: quay.io/strimzi/kafka:0.21.1-kafka-2.7.0
+    command: [
+        "sh", "-c",
+        "bin/kafka-server-start.sh config/server.properties --override 
listeners=$${KAFKA_LISTENERS} --override 
advertised.listeners=$${KAFKA_ADVERTISED_LISTENERS} --override 
zookeeper.connect=$${KAFKA_ZOOKEEPER_CONNECT}"
+    ]
+    depends_on:
+      - zookeeper
+    ports:
+      - "9092:9092"
+    environment:
+      LOG_DIR: "/tmp/logs"
+      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
+      KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
+      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
\ No newline at end of file
diff --git a/file-bindy-ftp/pom.xml b/kafka/pom.xml
similarity index 90%
copy from file-bindy-ftp/pom.xml
copy to kafka/pom.xml
index a77f93f..a32d86e 100644
--- a/file-bindy-ftp/pom.xml
+++ b/kafka/pom.xml
@@ -20,16 +20,16 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>camel-quarkus-examples-file-bindy-ftp</artifactId>
+    <artifactId>camel-quarkus-examples-kafka</artifactId>
     <groupId>org.apache.camel.quarkus.examples</groupId>
     <version>2.0.0-SNAPSHOT</version>
 
-    <name>Camel Quarkus :: Examples :: File Bindy FTP</name>
-    <description>Camel Quarkus Example :: File Bindy FTP</description>
+    <name>Camel Quarkus :: Examples :: Kafka</name>
+    <description>Camel Quarkus Example :: Kafka</description>
 
     <properties>
-        <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <camel-quarkus.version>2.0.0-SNAPSHOT</camel-quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -45,6 +45,7 @@
         <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
         <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
         <mycila-license.version>3.0</mycila-license.version>
+        <strimzi.testcontainers.version>0.20.1</strimzi.testcontainers.version>
     </properties>
 
     <dependencyManagement>
@@ -57,52 +58,41 @@
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <dependency>
-                <groupId>org.apache.camel.quarkus</groupId>
-                <artifactId>camel-quarkus-bom-test</artifactId>
-                <version>${camel-quarkus.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-bean</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-bindy</artifactId>
+            <artifactId>camel-quarkus-microprofile-health</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-direct</artifactId>
+            <artifactId>camel-quarkus-kafka</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-file</artifactId>
+            <artifactId>camel-quarkus-log</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-ftp</artifactId>
+            <artifactId>camel-quarkus-timer</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-log</artifactId>
+            <artifactId>camel-quarkus-seda</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-microprofile-health</artifactId>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jackson</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-seda</artifactId>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-kubernetes</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-timer</artifactId>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-container-image-docker</artifactId>
         </dependency>
 
         <!-- Test -->
@@ -112,6 +102,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.awaitility</groupId>
             <artifactId>awaitility</artifactId>
             <scope>test</scope>
@@ -121,6 +116,12 @@
             <artifactId>testcontainers</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>io.strimzi</groupId>
+            <artifactId>test-container</artifactId>
+            <version>${strimzi.testcontainers.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
@@ -211,7 +212,8 @@
                         <mapping>
                             <java>SLASHSTAR_STYLE</java>
                             <properties>CAMEL_PROPERTIES_STYLE</properties>
-                            <kt>SLASHSTAR_STYLE</kt>
+                            
<Dockerfile.jvm>CAMEL_PROPERTIES_STYLE</Dockerfile.jvm>
+                            
<Dockerfile.native>CAMEL_PROPERTIES_STYLE</Dockerfile.native>
                         </mapping>
                         <headerDefinitions>
                             
<headerDefinition>${maven.multiModuleProjectDirectory}/license-properties-headerdefinition.xml</headerDefinition>
diff --git a/kafka/src/main/docker/Dockerfile.jvm 
b/kafka/src/main/docker/Dockerfile.jvm
new file mode 100644
index 0000000..1e65c99
--- /dev/null
+++ b/kafka/src/main/docker/Dockerfile.jvm
@@ -0,0 +1,71 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+####
+# This Dockerfile is used in order to build a container that runs the Quarkus 
application in JVM mode
+#
+# Before building the container image run:
+#
+# ./mvnw package
+#
+# Then, build the image with:
+#
+# docker build -f src/main/docker/Dockerfile.jvm -t 
quarkus/camel-quarkus-examples-kafka-jvm .
+#
+# Then run the container using:
+#
+# docker run -i --rm -p 8080:8080 quarkus/camel-quarkus-examples-kafka-jvm
+#
+# If you want to include the debug port into your docker image
+# you will have to expose the debug port (default 5005) like this :  EXPOSE 
8080 5005
+#
+# Then run the container using :
+#
+# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" 
quarkus/camel-quarkus-examples-kafka-jvm
+#
+###
+FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
+
+ARG JAVA_PACKAGE=java-11-openjdk-headless
+ARG RUN_JAVA_VERSION=1.3.8
+ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
+# Install java and the run-java script
+# Also set up permissions for user `1001`
+RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
+    && microdnf update \
+    && microdnf clean all \
+    && mkdir /deployments \
+    && chown 1001 /deployments \
+    && chmod "g+rwX" /deployments \
+    && chown 1001:root /deployments \
+    && curl 
https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh
 -o /deployments/run-java.sh \
+    && chown 1001 /deployments/run-java.sh \
+    && chmod 540 /deployments/run-java.sh \
+    && echo "securerandom.source=file:/dev/urandom" >> 
/etc/alternatives/jre/conf/security/java.security
+
+# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display 
the heap size.
+ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 
-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
+# We make four distinct layers so if there are application changes the library 
layers can be re-used
+COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/
+COPY --chown=1001 target/quarkus-app/*.jar /deployments/
+COPY --chown=1001 target/quarkus-app/app/ /deployments/app/
+COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/
+
+EXPOSE 8080
+USER 1001
+
+ENTRYPOINT [ "/deployments/run-java.sh" ]
\ No newline at end of file
diff --git a/kafka/src/main/docker/Dockerfile.native 
b/kafka/src/main/docker/Dockerfile.native
new file mode 100644
index 0000000..04038f5
--- /dev/null
+++ b/kafka/src/main/docker/Dockerfile.native
@@ -0,0 +1,44 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+####
+# This Dockerfile is used in order to build a container that runs the Quarkus 
application in native (no JVM) mode
+#
+# Before building the container image run:
+#
+# ./mvnw package -Pnative
+#
+# Then, build the image with:
+#
+# docker build -f src/main/docker/Dockerfile.native -t 
quarkus/camel-quarkus-examples-kafka .
+#
+# Then run the container using:
+#
+# docker run -i --rm -p 8080:8080 quarkus/camel-quarkus-examples-kafka
+#
+###
+FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
+WORKDIR /work/
+RUN chown 1001 /work \
+    && chmod "g+rwX" /work \
+    && chown 1001:root /work
+COPY --chown=1001:root target/*-runner /work/application
+
+EXPOSE 8080
+USER 1001
+
+CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
\ No newline at end of file
diff --git a/kafka/src/main/java/org/apache/camel/example/KafkaResource.java 
b/kafka/src/main/java/org/apache/camel/example/KafkaResource.java
new file mode 100644
index 0000000..2850e8e
--- /dev/null
+++ b/kafka/src/main/java/org/apache/camel/example/KafkaResource.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.apache.camel.example;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.apache.camel.ConsumerTemplate;
+
+@ApplicationScoped
+@Path("example")
+public class KafkaResource {
+
+    @Inject
+    ConsumerTemplate consumerTemplate;
+
+    @GET
+    public String getMessages() {
+        return consumerTemplate.receiveBody("seda:kafka-messages", 10000, 
String.class);
+    }
+}
diff --git a/kafka/src/main/java/org/apache/camel/example/Routes.java 
b/kafka/src/main/java/org/apache/camel/example/Routes.java
new file mode 100644
index 0000000..0a29846
--- /dev/null
+++ b/kafka/src/main/java/org/apache/camel/example/Routes.java
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+package org.apache.camel.example;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class Routes extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        // produces messages to kafka
+        from("timer:foo?period={{timer.period}}&delay={{timer.delay}}")
+                .routeId("FromTimer2Kafka")
+                .setBody().simple("Message 
#${exchangeProperty.CamelTimerCounter}")
+                .to("kafka:{{kafka.topic.name}}")
+                .log("Message sent correctly sent to the topic! : \"${body}\" 
");
+
+        // kafka consumer
+        from("kafka:{{kafka.topic.name}}")
+                .routeId("FromKafka2Seda")
+                .log("Received : \"${body}\"")
+                .to("seda:kafka-messages");
+    }
+}
diff --git a/kafka/src/main/resources/application.properties 
b/kafka/src/main/resources/application.properties
new file mode 100644
index 0000000..12c8d81
--- /dev/null
+++ b/kafka/src/main/resources/application.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+#Kafka topic Name
+kafka.topic.name=test
+
+# How often should the messages be generated and pushed to Kafka Topic
+timer.period = 10000
+timer.delay = 10000
+
+#uncomment to set Kafka instance without Authentication
+#camel.component.kafka.brokers=<YOUR-KAFKA-BOOTSTRAP-URL-HERE>
+
+# uncomment to set Kafka instance with SASL Plain
+#camel.component.kafka.brokers=<YOUR-KAFKA-BOOTSTRAP-URL-HERE>
+#camel.component.kafka.security-protocol=SASL_SSL
+#camel.component.kafka.sasl-mechanism=PLAIN
+#camel.component.kafka.sasl-jaas-config=org.apache.kafka.common.security.plain.PlainLoginModule
 required username="<YOUR-SERVICE-ACCOUNT-ID-HERE>" 
password="<YOUR-SERVICE-ACCOUNT-SECRET-HERE>";
+
+# uncomment to set Kafka instance with SASL Oauth Bearer
+#camel.component.kafka.brokers = <YOUR-KAFKA-BOOTSTRAP-URL-HERE>
+#camel.component.kafka.security-protocol = SASL_SSL
+#camel.component.kafka.sasl-mechanism = OAUTHBEARER
+#camel.component.kafka.sasl-jaas-config = 
org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
+#        oauth.client.id=<YOUR-SERVICE-ACCOUNT-ID-HERE> \
+#        oauth.client.secret=<YOUR-SERVICE-ACCOUNT-SECRET-HERE> \
+#        oauth.token.endpoint.uri="<TOKEN_ENDPOINT_URI>" ;
+#camel.component.kafka.additional-properties[sasl.login.callback.handler.class]
 = io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandler
+
+
+# Kubernetes
+
+# Uncomment to trust self signed certificates if they are presented by the 
Kubernetes API server
+#quarkus.kubernetes-client.trust-certs=true
+
+quarkus.kubernetes.image-pull-policy=IfNotPresent
+
+# Uncomment to set resource limits
+#quarkus.kubernetes.resources.requests.memory=64Mi
+#quarkus.kubernetes.resources.requests.cpu=250m
+#quarkus.kubernetes.resources.limits.memory=512Mi
+#quarkus.kubernetes.resources.limits.cpu=1000m
+
+# OpenShift
+quarkus.openshift.image-pull-policy=IfNotPresent
+
+
+# Uncomment to set resource limits
+#quarkus.openshift.resources.requests.memory=64Mi
+#quarkus.openshift.resources.requests.cpu=250m
+#quarkus.openshift.resources.limits.memory=512Mi
+#quarkus.openshift.resources.limits.cpu=1000m
+
+
+#uncomment to set container build
+#quarkus.container-image.builder=docker
+#quarkus.kubernetes.deployment-target=kubernetes
+#quarkus.container-image.push=true
+#quarkus.container-image.group=<YOUR_IMAGE_GROUP>
+
diff --git a/kafka/src/test/java/org/apache/camel/example/KafkaIT.java 
b/kafka/src/test/java/org/apache/camel/example/KafkaIT.java
new file mode 100644
index 0000000..857c965
--- /dev/null
+++ b/kafka/src/test/java/org/apache/camel/example/KafkaIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+package org.apache.camel.example;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class KafkaIT extends KafkaTest {
+}
diff --git a/kafka/src/test/java/org/apache/camel/example/KafkaTest.java 
b/kafka/src/test/java/org/apache/camel/example/KafkaTest.java
new file mode 100644
index 0000000..235ea9b
--- /dev/null
+++ b/kafka/src/test/java/org/apache/camel/example/KafkaTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.apache.camel.example;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.containsString;
+
+@QuarkusTest
+@QuarkusTestResource(StrimziTestResource.class)
+public class KafkaTest {
+
+    @Test
+    public void testKafka() {
+        RestAssured.get("/example")
+                .then()
+                .statusCode(200)
+                .body(containsString("Message #"));
+    }
+}
diff --git 
a/kafka/src/test/java/org/apache/camel/example/StrimziTestResource.java 
b/kafka/src/test/java/org/apache/camel/example/StrimziTestResource.java
new file mode 100644
index 0000000..12e0552
--- /dev/null
+++ b/kafka/src/test/java/org/apache/camel/example/StrimziTestResource.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.apache.camel.example;
+
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import io.strimzi.StrimziKafkaContainer;
+import org.apache.camel.util.CollectionHelper;
+
+public class StrimziTestResource implements 
QuarkusTestResourceLifecycleManager {
+
+    private StrimziKafkaContainer strimziKafkaContainer;
+    private static final int KAFKA_PORT = 9092;
+    private static final String KAFKA_STRIMZI_VERSION = "0.20.1-kafka-2.5.0";
+
+    @Override
+    public Map<String, String> start() {
+        strimziKafkaContainer = new 
StrimziKafkaContainer(KAFKA_STRIMZI_VERSION);
+        strimziKafkaContainer.start();
+
+        String bootstrap_servers = 
strimziKafkaContainer.getContainerIpAddress() + ":"
+                + strimziKafkaContainer.getMappedPort(KAFKA_PORT);
+
+        return CollectionHelper.mapOf(
+                "camel.component.kafka.brokers", bootstrap_servers);
+    }
+
+    @Override
+    public void stop() {
+        if (strimziKafkaContainer != null) {
+            strimziKafkaContainer.stop();
+        }
+    }
+}
diff --git a/observability/pom.xml b/observability/pom.xml
index ab265d4..8110af3 100644
--- a/observability/pom.xml
+++ b/observability/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/rest-json/pom.xml b/rest-json/pom.xml
index 2fe3d1a..b78a076 100644
--- a/rest-json/pom.xml
+++ b/rest-json/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-cdi/pom.xml b/timer-log-cdi/pom.xml
index 622fb07..75ebdcb 100644
--- a/timer-log-cdi/pom.xml
+++ b/timer-log-cdi/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-kotlin/pom.xml b/timer-log-kotlin/pom.xml
index 13a4e85..594ac28 100644
--- a/timer-log-kotlin/pom.xml
+++ b/timer-log-kotlin/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
         <kotlin.version>1.4.32</kotlin.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/timer-log-main/pom.xml b/timer-log-main/pom.xml
index 033cc02..c7faab1 100644
--- a/timer-log-main/pom.xml
+++ b/timer-log-main/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-spring/pom.xml b/timer-log-spring/pom.xml
index 092210e..1c54e19 100644
--- a/timer-log-spring/pom.xml
+++ b/timer-log-spring/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log-xml/pom.xml b/timer-log-xml/pom.xml
index f5836e9..393897f 100644
--- a/timer-log-xml/pom.xml
+++ b/timer-log-xml/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
diff --git a/timer-log/pom.xml b/timer-log/pom.xml
index 3c757f3..f6c68c1 100644
--- a/timer-log/pom.xml
+++ b/timer-log/pom.xml
@@ -29,7 +29,7 @@
 
     <properties>
         <camel-quarkus.version>2.0.0</camel-quarkus.version>
-        <quarkus.version>2.0.0.CR2</quarkus.version>
+        <quarkus.version>2.0.0.CR3</quarkus.version>
 
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Reply via email to