This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 21544b2 Timer example (#312)
21544b2 is described below
commit 21544b2351e2e25ef4d12828878b525aac1507f6
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Oct 22 15:04:27 2019 +0200
Timer example (#312)
* #310: A simple timer to log example as hello world
* #310: A simple timer to log example as hello world
* #310: Polished
* Update examples/timer-log/README.adoc
Co-Authored-By: Peter Palaga <[email protected]>
---
examples/pom.xml | 1 +
examples/timer-log/README.adoc | 27 ++++++
examples/timer-log/pom.xml | 102 +++++++++++++++++++++
.../src/main/java/org/acme/timer/TimerRoute.java | 28 ++++++
.../src/main/resources/application.properties | 27 ++++++
5 files changed, 185 insertions(+)
diff --git a/examples/pom.xml b/examples/pom.xml
index 6d42d4c..2c7780b 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -32,6 +32,7 @@
<name>Camel Quarkus :: Examples</name>
<modules>
+ <module>timer-log</module>
<module>rest-json</module>
</modules>
diff --git a/examples/timer-log/README.adoc b/examples/timer-log/README.adoc
new file mode 100644
index 0000000..c72eeef
--- /dev/null
+++ b/examples/timer-log/README.adoc
@@ -0,0 +1,27 @@
+= timer-log
+
+This is a basic hello world example that uses a Camel timer that
+triggers every second and prints to the log.
+
+To run it:
+
+[source,text]
+----
+$ mvn clean compile quarkus:dev -DnoDeps
+----
+This compiles the project and starts the Quarkus tooling in the
https://quarkus.io/guides/maven-tooling#development-mode[develpment mode].
+Then look at the log output in the console. As we run the example
+in Quarkus Dev Mode, you can edit the source code and have live updates.
+For example try to change the logging output to be `Bye World`.
+
+== Native build
+
+To build as native:
+
+[source,text]
+----
+$ mvn package -Pnative
+----
+
+This requires having GraalVM and other tools installed.
+See the https://quarkus.io/guides/building-native-image-guide[Quarkus Native
Guide] for details.
diff --git a/examples/timer-log/pom.xml b/examples/timer-log/pom.xml
new file mode 100644
index 0000000..db54f80
--- /dev/null
+++ b/examples/timer-log/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<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">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>0.2.1-SNAPSHOT</version>
+ <relativePath>../../poms/bom/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-examples-timer-log</artifactId>
+ <name>Camel Quarkus :: Examples :: Timer Log</name>
+ <description>Camel Quarkus Example :: Timer to Log</description>
+
+ <properties>
+ <!-- to use docker build instead of native
+ <native-image.docker-build>true</native-image.docker-build>
+ <native-image.container-runtime>docker</native-image.container-runtime>
+ -->
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-timer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-log</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>native-image</id>
+ <goals>
+ <goal>native-image</goal>
+ </goals>
+ <configuration>
+ <enableServer>false</enableServer>
+ <cleanupServer>true</cleanupServer>
+ <disableReports>true</disableReports>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/examples/timer-log/src/main/java/org/acme/timer/TimerRoute.java
b/examples/timer-log/src/main/java/org/acme/timer/TimerRoute.java
new file mode 100644
index 0000000..247da3f
--- /dev/null
+++ b/examples/timer-log/src/main/java/org/acme/timer/TimerRoute.java
@@ -0,0 +1,28 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.acme.timer;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class TimerRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("timer:foo?period=1s")
+ .log("Hello World");
+ }
+}
diff --git a/examples/timer-log/src/main/resources/application.properties
b/examples/timer-log/src/main/resources/application.properties
new file mode 100644
index 0000000..abf3895
--- /dev/null
+++ b/examples/timer-log/src/main/resources/application.properties
@@ -0,0 +1,27 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.log.file.enable = false
+quarkus.ssl.native=true
+
+#
+# Camel
+#
+camel.context.name = quarkus-camel-example-timer-log
+