Skip to content

Commit bf25532

Browse files
committed
Variables example
1 parent a89c384 commit bf25532

File tree

7 files changed

+787
-0
lines changed

7 files changed

+787
-0
lines changed

variables/README.adoc

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
= Timer Hello World: A Camel Quarkus example
2+
:cq-example-description: An example that uses the Camel timer component to output a Hello world message to the console
3+
4+
{cq-description}
5+
6+
TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
7+
and other general information.
8+
9+
== Start in the Development mode
10+
11+
[source,shell]
12+
----
13+
$ mvn clean compile quarkus:dev
14+
----
15+
16+
The above command compiles the project, starts the application and lets the Quarkus tooling watch for changes in your
17+
workspace. Any modifications in your project will automatically take effect in the running application.
18+
19+
TIP: Please refer to the Development mode section of
20+
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel Quarkus User guide] for more details.
21+
22+
Then look at the log output in the console. There are log messages generated from a second route. First several message show random number `N/A` (as is defined in application.properties). Following messages show random number generated by the first route, which starts delayed.
23+
24+
As we run the example in Quarkus Dev Mode, you can edit the source code and have live updates.
25+
For example, try to change the default greeting message in `application.properties` to `Greeting`.
26+
27+
The delay of the random nember generation and period at which the timer fires can be changed by modifying configuration properties `timer.period` and
28+
`timer.delay` in `application.properties`. You can also override the default values via the command line with JVM arguments
29+
`-Dtimer.period=100 -Dtimer.delay=1000'
30+
31+
=== Package and run the application
32+
33+
Once you are done with developing you may want to package and run the application.
34+
35+
TIP: Find more details about the JVM mode and Native mode in the Package and run section of
36+
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel Quarkus User guide]
37+
38+
==== JVM mode
39+
40+
[source,shell]
41+
----
42+
$ mvn clean package
43+
$ java -jar target/quarkus-app/quarkus-run.jar
44+
...
45+
[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
46+
----
47+
48+
==== Native mode
49+
50+
IMPORTANT: Native mode requires having GraalVM and other tools installed. Please check the Prerequisites section
51+
of https://camel.apache.org/camel-quarkus/latest/first-steps.html#_prerequisites[Camel Quarkus User guide].
52+
53+
To prepare a native executable using GraalVM, run the following command:
54+
55+
[source,shell]
56+
----
57+
$ mvn clean package -Pnative
58+
$ ./target/*-runner
59+
...
60+
[io.quarkus] (main) camel-quarkus-examples-... started in 0.013s.
61+
...
62+
----
63+
64+
== Feedback
65+
66+
Please report bugs and propose improvements via https://github.com/apache/camel-quarkus/issues[GitHub issues of Camel Quarkus] project.

variables/eclipse-formatter-config.xml

Lines changed: 276 additions & 0 deletions
Large diffs are not rendered by default.

variables/pom.xml

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one or more
5+
contributor license agreements. See the NOTICE file distributed with
6+
this work for additional information regarding copyright ownership.
7+
The ASF licenses this file to You under the Apache License, Version 2.0
8+
(the "License"); you may not use this file except in compliance with
9+
the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
<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">
21+
<modelVersion>4.0.0</modelVersion>
22+
23+
<artifactId>camel-quarkus-examples-variables</artifactId>
24+
<groupId>org.apache.camel.quarkus.examples</groupId>
25+
<version>3.7.0-SNAPSHOT</version>
26+
27+
<name>Camel Quarkus :: Examples :: Variables</name>
28+
<description>Camel Quarkus Example :: Variables</description>
29+
30+
<properties>
31+
<quarkus.platform.version>3.6.4</quarkus.platform.version>
32+
<camel-quarkus.platform.version>3.7.0-SNAPSHOT</camel-quarkus.platform.version>
33+
34+
<!-- TODO: https://github.com/apache/camel-quarkus/issues/3156 -->
35+
<camel-quarkus.version>${camel-quarkus.platform.version}</camel-quarkus.version>
36+
37+
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
38+
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
39+
<camel-quarkus.platform.group-id>org.apache.camel.quarkus</camel-quarkus.platform.group-id>
40+
<camel-quarkus.platform.artifact-id>camel-quarkus-bom</camel-quarkus.platform.artifact-id>
41+
42+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
43+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
44+
<maven.compiler.target>17</maven.compiler.target>
45+
<maven.compiler.source>17</maven.compiler.source>
46+
<maven.compiler.testTarget>${maven.compiler.target}</maven.compiler.testTarget>
47+
<maven.compiler.testSource>${maven.compiler.source}</maven.compiler.testSource>
48+
49+
<formatter-maven-plugin.version>2.23.0</formatter-maven-plugin.version>
50+
<impsort-maven-plugin.version>1.9.0</impsort-maven-plugin.version>
51+
<license-maven-plugin.version>4.2</license-maven-plugin.version>
52+
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
53+
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
54+
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
55+
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
56+
57+
<quarkus.runner>${project.build.directory}/quarkus-app/quarkus-run.jar</quarkus.runner>
58+
</properties>
59+
60+
<dependencyManagement>
61+
<dependencies>
62+
<!-- Import BOM -->
63+
<dependency>
64+
<groupId>${quarkus.platform.group-id}</groupId>
65+
<artifactId>${quarkus.platform.artifact-id}</artifactId>
66+
<version>${quarkus.platform.version}</version>
67+
<type>pom</type>
68+
<scope>import</scope>
69+
</dependency>
70+
<dependency>
71+
<groupId>${camel-quarkus.platform.group-id}</groupId>
72+
<artifactId>${camel-quarkus.platform.artifact-id}</artifactId>
73+
<version>${camel-quarkus.platform.version}</version>
74+
<type>pom</type>
75+
<scope>import</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>org.apache.camel.quarkus</groupId>
79+
<artifactId>camel-quarkus-bom-test</artifactId>
80+
<version>${camel-quarkus.version}</version>
81+
<type>pom</type>
82+
<scope>import</scope>
83+
</dependency>
84+
</dependencies>
85+
</dependencyManagement>
86+
87+
<dependencies>
88+
<dependency>
89+
<groupId>org.apache.camel.quarkus</groupId>
90+
<artifactId>camel-quarkus-log</artifactId>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.apache.camel.quarkus</groupId>
94+
<artifactId>camel-quarkus-timer</artifactId>
95+
</dependency>
96+
97+
<!-- Test -->
98+
<dependency>
99+
<groupId>io.quarkus</groupId>
100+
<artifactId>quarkus-junit5</artifactId>
101+
<scope>test</scope>
102+
</dependency>
103+
<dependency>
104+
<groupId>io.rest-assured</groupId>
105+
<artifactId>rest-assured</artifactId>
106+
<scope>test</scope>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.apache.camel.quarkus</groupId>
110+
<artifactId>camel-quarkus-integration-tests-process-executor-support</artifactId>
111+
<version>${camel-quarkus.version}</version>
112+
<scope>test</scope>
113+
</dependency>
114+
<dependency>
115+
<groupId>org.awaitility</groupId>
116+
<artifactId>awaitility</artifactId>
117+
<scope>test</scope>
118+
</dependency>
119+
</dependencies>
120+
121+
<build>
122+
<pluginManagement>
123+
<plugins>
124+
125+
<plugin>
126+
<groupId>net.revelc.code.formatter</groupId>
127+
<artifactId>formatter-maven-plugin</artifactId>
128+
<version>${formatter-maven-plugin.version}</version>
129+
<configuration>
130+
<configFile>${maven.multiModuleProjectDirectory}/eclipse-formatter-config.xml</configFile>
131+
<lineEnding>LF</lineEnding>
132+
</configuration>
133+
</plugin>
134+
135+
<plugin>
136+
<groupId>net.revelc.code</groupId>
137+
<artifactId>impsort-maven-plugin</artifactId>
138+
<version>${impsort-maven-plugin.version}</version>
139+
<configuration>
140+
<groups>java.,javax.,org.w3c.,org.xml.,junit.</groups>
141+
<removeUnused>true</removeUnused>
142+
<staticAfter>true</staticAfter>
143+
<staticGroups>java.,javax.,org.w3c.,org.xml.,junit.</staticGroups>
144+
</configuration>
145+
</plugin>
146+
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-compiler-plugin</artifactId>
150+
<version>${maven-compiler-plugin.version}</version>
151+
<configuration>
152+
<showDeprecation>true</showDeprecation>
153+
<showWarnings>true</showWarnings>
154+
<compilerArgs>
155+
<arg>-Xlint:unchecked</arg>
156+
</compilerArgs>
157+
</configuration>
158+
</plugin>
159+
160+
<plugin>
161+
<groupId>org.apache.maven.plugins</groupId>
162+
<artifactId>maven-surefire-plugin</artifactId>
163+
<version>${maven-surefire-plugin.version}</version>
164+
<configuration>
165+
<failIfNoTests>false</failIfNoTests>
166+
<systemPropertyVariables>
167+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
168+
</systemPropertyVariables>
169+
</configuration>
170+
</plugin>
171+
172+
<plugin>
173+
<groupId>${quarkus.platform.group-id}</groupId>
174+
<artifactId>quarkus-maven-plugin</artifactId>
175+
<version>${quarkus.platform.version}</version>
176+
</plugin>
177+
178+
<plugin>
179+
<groupId>org.apache.maven.plugins</groupId>
180+
<artifactId>maven-failsafe-plugin</artifactId>
181+
<version>${maven-surefire-plugin.version}</version>
182+
</plugin>
183+
184+
<plugin>
185+
<groupId>org.apache.maven.plugins</groupId>
186+
<artifactId>maven-jar-plugin</artifactId>
187+
<version>${maven-jar-plugin.version}</version>
188+
</plugin>
189+
190+
<plugin>
191+
<groupId>com.mycila</groupId>
192+
<artifactId>license-maven-plugin</artifactId>
193+
<version>${license-maven-plugin.version}</version>
194+
<configuration>
195+
<failIfUnknown>true</failIfUnknown>
196+
<header>${maven.multiModuleProjectDirectory}/header.txt</header>
197+
<excludes>
198+
<exclude>**/*.adoc</exclude>
199+
<exclude>**/*.txt</exclude>
200+
<exclude>**/LICENSE.txt</exclude>
201+
<exclude>**/LICENSE</exclude>
202+
<exclude>**/NOTICE.txt</exclude>
203+
<exclude>**/NOTICE</exclude>
204+
<exclude>**/README</exclude>
205+
<exclude>**/pom.xml.versionsBackup</exclude>
206+
</excludes>
207+
<mapping>
208+
<java>SLASHSTAR_STYLE</java>
209+
<properties>CAMEL_PROPERTIES_STYLE</properties>
210+
<kt>SLASHSTAR_STYLE</kt>
211+
</mapping>
212+
<headerDefinitions>
213+
<headerDefinition>${maven.multiModuleProjectDirectory}/license-properties-headerdefinition.xml</headerDefinition>
214+
</headerDefinitions>
215+
</configuration>
216+
</plugin>
217+
</plugins>
218+
</pluginManagement>
219+
220+
<plugins>
221+
<plugin>
222+
<groupId>${quarkus.platform.group-id}</groupId>
223+
<artifactId>quarkus-maven-plugin</artifactId>
224+
<executions>
225+
<execution>
226+
<id>build</id>
227+
<goals>
228+
<goal>build</goal>
229+
</goals>
230+
</execution>
231+
</executions>
232+
</plugin>
233+
234+
<plugin>
235+
<groupId>net.revelc.code.formatter</groupId>
236+
<artifactId>formatter-maven-plugin</artifactId>
237+
<executions>
238+
<execution>
239+
<id>format</id>
240+
<goals>
241+
<goal>format</goal>
242+
</goals>
243+
<phase>process-sources</phase>
244+
</execution>
245+
</executions>
246+
</plugin>
247+
248+
<plugin>
249+
<groupId>net.revelc.code</groupId>
250+
<artifactId>impsort-maven-plugin</artifactId>
251+
<executions>
252+
<execution>
253+
<id>sort-imports</id>
254+
<goals>
255+
<goal>sort</goal>
256+
</goals>
257+
<phase>process-sources</phase>
258+
</execution>
259+
</executions>
260+
</plugin>
261+
</plugins>
262+
</build>
263+
264+
<profiles>
265+
<profile>
266+
<id>native</id>
267+
<activation>
268+
<property>
269+
<name>native</name>
270+
</property>
271+
</activation>
272+
<properties>
273+
<quarkus.package.type>native</quarkus.package.type>
274+
</properties>
275+
<build>
276+
<plugins>
277+
<plugin>
278+
<groupId>org.apache.maven.plugins</groupId>
279+
<artifactId>maven-failsafe-plugin</artifactId>
280+
<executions>
281+
<execution>
282+
<goals>
283+
<goal>integration-test</goal>
284+
<goal>verify</goal>
285+
</goals>
286+
<configuration>
287+
<systemPropertyVariables>
288+
<quarkus.package.type>${quarkus.package.type}</quarkus.package.type>
289+
</systemPropertyVariables>
290+
</configuration>
291+
</execution>
292+
</executions>
293+
</plugin>
294+
</plugins>
295+
</build>
296+
</profile>
297+
</profiles>
298+
299+
</project>

0 commit comments

Comments
 (0)