You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/12/13 08:50:51 UTC

[camel-quarkus] branch master updated: examples: add timer-log kotlin example

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

lburgazzoli 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 b13e1fc  examples: add timer-log kotlin example
b13e1fc is described below

commit b13e1fc792e7075989465bb3a22611e58d7282f2
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Thu Dec 12 18:03:16 2019 +0100

    examples: add timer-log kotlin example
---
 examples/pom.xml                                   |   1 +
 examples/timer-log-kotlin/pom.xml                  | 124 +++++++++++++++++++++
 .../src/main/kotlin/org/acme/timer/TimerRoute.kt   |  27 +++++
 .../src/main/resources/application.properties      |  28 +++++
 pom.xml                                            |   1 +
 5 files changed, 181 insertions(+)

diff --git a/examples/pom.xml b/examples/pom.xml
index 97af832..b240960 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -36,6 +36,7 @@
         <module>rest-json</module>
         <module>timer-log</module>
         <module>timer-log-cdi</module>
+        <module>timer-log-kotlin</module>
         <module>timer-log-xml</module>
         <module>timer-log-spring</module>
     </modules>
diff --git a/examples/timer-log-kotlin/pom.xml b/examples/timer-log-kotlin/pom.xml
new file mode 100644
index 0000000..8a92642
--- /dev/null
+++ b/examples/timer-log-kotlin/pom.xml
@@ -0,0 +1,124 @@
+<?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-build-parent</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent/pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-quarkus-examples-timer-log-kotlin</artifactId>
+    <name>Camel Quarkus :: Examples :: Timer Log Kotlin</name>
+    <description>Camel Quarkus Example :: Timer to Log Kotlin</description>
+
+    <properties>
+        <kotlin.version>1.3.21</kotlin.version>
+    </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>
+        <dependency>
+            <groupId>org.jetbrains.kotlin</groupId>
+            <artifactId>kotlin-stdlib-jdk8</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <sourceDirectory>src/main/kotlin</sourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>build</id>
+                        <goals>
+                            <goal>build</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.jetbrains.kotlin</groupId>
+                <artifactId>kotlin-maven-plugin</artifactId>
+                <version>${kotlin.version}</version>
+                <executions>
+                    <execution>
+                        <id>compile</id>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>test-compile</id>
+                        <phase>test-compile</phase>
+                        <goals>
+                            <goal>test-compile</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-kotlin/src/main/kotlin/org/acme/timer/TimerRoute.kt b/examples/timer-log-kotlin/src/main/kotlin/org/acme/timer/TimerRoute.kt
new file mode 100644
index 0000000..92fb6d4
--- /dev/null
+++ b/examples/timer-log-kotlin/src/main/kotlin/org/acme/timer/TimerRoute.kt
@@ -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.
+ */
+package org.acme.timer
+
+import org.apache.camel.builder.RouteBuilder
+
+class TimerRoute: RouteBuilder() {
+    override fun configure() {
+        from("timer:foo?period=1s")
+                .process { e -> e.message.body = "Hello from Kotlin!" }
+                .log("\${body}")
+    }
+}
\ No newline at end of file
diff --git a/examples/timer-log-kotlin/src/main/resources/application.properties b/examples/timer-log-kotlin/src/main/resources/application.properties
new file mode 100644
index 0000000..15ba448
--- /dev/null
+++ b/examples/timer-log-kotlin/src/main/resources/application.properties
@@ -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
+##
+##      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
+
+quarkus.log.category."org.apache.camel.main".level = DEBUG
+
+#
+# Camel
+#
+camel.context.name = quarkus-camel-example-timer-log-kotlin
diff --git a/pom.xml b/pom.xml
index 8eb4df4..c3f2aeb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -304,6 +304,7 @@
                             <properties>CAMEL_PROPERTIES_STYLE</properties>
                             <spring.factories>CAMEL_PROPERTIES_STYLE</spring.factories>
                             <spring.provides>CAMEL_PROPERTIES_STYLE</spring.provides>
+                            <kt>SLASHSTAR_STYLE</kt>
                         </mapping>
                         <headerDefinitions>
                             <headerDefinition>license-properties-headerdefinition.xml</headerDefinition>