You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/11/18 09:59:57 UTC

[camel-examples] branch main updated (6e2e180 -> 4a4d55e)

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

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


    from 6e2e180  Polished
     new 7c13a5d  CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
     new 25013e1  CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
     new 2957de5  CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
     new c31a82b  Fixed example
     new 4a4d55e  Regen

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/README.adoc                               |  4 ++-
 .../apache/camel/example/cdi/xml/Application.java  |  3 +-
 examples/main-xml/README.adoc                      | 11 +++---
 examples/main-xml/src/main/data/foo.properties     | 18 ----------
 .../org/apache/camel/example/MyApplication.java    |  4 +++
 .../org/apache/camel/example/MyRouteBuilder.java   | 31 -----------------
 .../src/main/resources/application.properties      | 39 ++++++----------------
 .../src/main/resources/routes/my-route.xml         |  2 +-
 examples/main-yaml/README.adoc                     | 27 +++++++++++++++
 examples/{main-xml => main-yaml}/pom.xml           |  9 +++--
 .../org/apache/camel/example/MyApplication.java    |  8 +++--
 .../main/java/org/apache/camel/example/MyBean.java |  0
 .../org/apache/camel/example/MyConfiguration.java  |  0
 .../src/main/resources/application.properties      | 12 ++++---
 .../src/main/resources/logback.xml                 |  0
 .../src/main/resources/routes/my-route.yaml        | 23 ++++++-------
 examples/pom.xml                                   |  1 +
 17 files changed, 83 insertions(+), 109 deletions(-)
 delete mode 100644 examples/main-xml/src/main/data/foo.properties
 delete mode 100644 examples/main-xml/src/main/java/org/apache/camel/example/MyRouteBuilder.java
 create mode 100644 examples/main-yaml/README.adoc
 copy examples/{main-xml => main-yaml}/pom.xml (92%)
 copy examples/{main-xml => main-yaml}/src/main/java/org/apache/camel/example/MyApplication.java (80%)
 copy examples/{main => main-yaml}/src/main/java/org/apache/camel/example/MyBean.java (100%)
 copy examples/{main => main-yaml}/src/main/java/org/apache/camel/example/MyConfiguration.java (100%)
 copy examples/{main-lambda => main-yaml}/src/main/resources/application.properties (82%)
 copy examples/{routetemplate => main-yaml}/src/main/resources/logback.xml (100%)
 copy .asf.yaml => examples/main-yaml/src/main/resources/routes/my-route.yaml (69%)

[camel-examples] 02/05: CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 25013e1116e379749cff464d34b672127f021aaa
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 09:27:14 2021 +0100

    CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
---
 examples/main-yaml/README.adoc                     |  27 +++++
 examples/main-yaml/pom.xml                         | 111 +++++++++++++++++++++
 .../org/apache/camel/example/MyApplication.java    |  46 +++++++++
 .../main/java/org/apache/camel/example/MyBean.java |  36 +++++++
 .../org/apache/camel/example/MyConfiguration.java  |  37 +++++++
 .../src/main/resources/application.properties      |  39 ++++++++
 examples/main-yaml/src/main/resources/logback.xml  |  30 ++++++
 .../src/main/resources/routes/my-route.yaml        |  10 ++
 8 files changed, 336 insertions(+)

diff --git a/examples/main-yaml/README.adoc b/examples/main-yaml/README.adoc
new file mode 100644
index 0000000..f8432bf
--- /dev/null
+++ b/examples/main-yaml/README.adoc
@@ -0,0 +1,27 @@
+== Camel Example Main YAML
+
+This example shows how to run Camel standalone (YAML routes) via the built-in Main class.
+
+The route is located in `src/main/resources/routes` as an YAML file.
+
+This example has been enabled with live reload, so while the Camel
+application is running, then you can edit the route in the YAML file,
+and when saved Camel will auto update the route(s).
+
+The application is configured in the `application.properties` file.
+
+=== How to run
+
+You can run this example using
+
+    mvn camel:run
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!
diff --git a/examples/main-yaml/pom.xml b/examples/main-yaml/pom.xml
new file mode 100644
index 0000000..c404895
--- /dev/null
+++ b/examples/main-yaml/pom.xml
@@ -0,0 +1,111 @@
+<?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/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel.example</groupId>
+        <artifactId>examples</artifactId>
+        <version>3.14.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-example-main-yaml</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Example :: Main :: YAML</name>
+    <description>An example for showing standalone Camel using YAML</description>
+
+    <properties>
+        <category>Beginner</category>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Add Camel BOM -->
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-bom</artifactId>
+                <version>${camel.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <!-- use camel-main to bootstrap camel -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-main</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-yaml-dsl</artifactId>
+        </dependency>
+
+        <!-- and we use these components -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-bean</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-quartz</artifactId>
+        </dependency>
+
+        <!-- logging -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>${log4j2-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>${logback-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>${logback-version}</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-maven-plugin</artifactId>
+                <version>${camel.version}</version>
+                <configuration>
+                    <logClasspath>false</logClasspath>
+                    <mainClass>org.apache.camel.example.MyApplication</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java b/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java
new file mode 100644
index 0000000..4396bb7
--- /dev/null
+++ b/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.apache.camel.main.Main;
+
+/**
+ * Main class that boot the Camel application
+ */
+public final class MyApplication {
+
+    private MyApplication() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        // use Camels Main class
+        Main main = new Main();
+        // lets use a configuration class (you can specify multiple classes)
+        // (properties are automatic loaded from application.properties)
+        main.configure().addConfigurationClass(MyConfiguration.class);
+        // and add all the XML routes
+        main.configure().withRoutesIncludePattern("routes/*.xml");
+        // turn on reloading routes on code-changes
+        main.configure().withRoutesReloadEnabled(true);
+        main.configure().withRoutesReloadDirectory("src/main/resources");
+        main.configure().withRoutesReloadPattern("routes/*.yaml");
+
+        // now keep the application running until the JVM is terminated (ctrl + c or sigterm)
+        main.run(args);
+    }
+
+}
diff --git a/examples/main-yaml/src/main/java/org/apache/camel/example/MyBean.java b/examples/main-yaml/src/main/java/org/apache/camel/example/MyBean.java
new file mode 100644
index 0000000..1e1bdb8
--- /dev/null
+++ b/examples/main-yaml/src/main/java/org/apache/camel/example/MyBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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;
+
+public class MyBean {
+
+    private String hi;
+    private String bye;
+
+    public MyBean(String hi, String bye) {
+        this.hi = hi;
+        this.bye = bye;
+    }
+
+    public String hello() {
+        return hi + " how are you?";
+    }
+
+    public String bye() {
+        return bye + " World";
+    }
+}
diff --git a/examples/main-yaml/src/main/java/org/apache/camel/example/MyConfiguration.java b/examples/main-yaml/src/main/java/org/apache/camel/example/MyConfiguration.java
new file mode 100644
index 0000000..9c26fdd
--- /dev/null
+++ b/examples/main-yaml/src/main/java/org/apache/camel/example/MyConfiguration.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 org.apache.camel.BindToRegistry;
+import org.apache.camel.PropertyInject;
+
+/**
+ * Class to configure the Camel application.
+ */
+public class MyConfiguration {
+
+    @BindToRegistry
+    public MyBean myBean(@PropertyInject("hi") String hi, @PropertyInject("bye") String bye) {
+        // this will create an instance of this bean with the name of the method (eg myBean)
+        return new MyBean(hi, bye);
+    }
+
+    public void configure() {
+        // this method is optional and can be removed if no additional configuration is needed.
+    }
+
+}
diff --git a/examples/main-yaml/src/main/resources/application.properties b/examples/main-yaml/src/main/resources/application.properties
new file mode 100644
index 0000000..f8a38f8
--- /dev/null
+++ b/examples/main-yaml/src/main/resources/application.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# to configure camel main
+# here you can configure options on camel main (see MainConfigurationProperties class)
+camel.main.name = MyYamlCamel
+
+# turn on route reloading on file changes
+camel.main.routes-reload-enabled = true
+# the base directory to watch
+camel.main.routes-reload-directory = src/main/resources
+# pattern(s) for files to watch
+camel.main.routes-reload-pattern = routes/*.yaml
+
+# to configure the camel quartz component
+# here we can configure the options on the component level (and we can use dash-naming-style)
+camel.component.quartz.start-delayed-seconds = 3
+
+# properties used in the route
+myCron = 0/2 * * * * ?
+
+# application properties
+hi = Hello
+bye = Bye
+
diff --git a/examples/main-yaml/src/main/resources/logback.xml b/examples/main-yaml/src/main/resources/logback.xml
new file mode 100644
index 0000000..a798d0b
--- /dev/null
+++ b/examples/main-yaml/src/main/resources/logback.xml
@@ -0,0 +1,30 @@
+<?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.
+
+-->
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>
diff --git a/examples/main-yaml/src/main/resources/routes/my-route.yaml b/examples/main-yaml/src/main/resources/routes/my-route.yaml
new file mode 100644
index 0000000..0abd0ac
--- /dev/null
+++ b/examples/main-yaml/src/main/resources/routes/my-route.yaml
@@ -0,0 +1,10 @@
+from:
+  route-id: "foo"
+  uri: "quartz:foo"
+  parameters:
+    cron: "{{period}}"
+  steps:
+    - to: "bean:myBean.hello"
+    - log: "${body}"
+    - to: "bean:myBean.bye"
+    - log: "${body}"

[camel-examples] 01/05: CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7c13a5d5b270385b05df8ecd30e1649f085b4149
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 08:57:38 2021 +0100

    CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
---
 examples/main-xml/README.adoc                      | 11 ++++---
 examples/main-xml/src/main/data/foo.properties     | 18 ----------
 .../org/apache/camel/example/MyApplication.java    |  4 +++
 .../org/apache/camel/example/MyRouteBuilder.java   | 31 ------------------
 .../src/main/resources/application.properties      | 38 +++++-----------------
 .../src/main/resources/routes/my-route.xml         |  2 +-
 6 files changed, 20 insertions(+), 84 deletions(-)

diff --git a/examples/main-xml/README.adoc b/examples/main-xml/README.adoc
index 4db6d9b..b7ca179 100644
--- a/examples/main-xml/README.adoc
+++ b/examples/main-xml/README.adoc
@@ -1,11 +1,14 @@
 == Camel Example Main XML
 
 This example shows how to run Camel standalone (XML routes) via the built-in Main class.
-The example also demonstrates how you can configure the Camel application
-via Camel built-in dependency-injection that supports binding via the
-`@BindToRegistry`, `@BeanInject` and `@PropertyInject` annotations.
 
-Also notice how you can configure Camel in the `application.properties` file.
+The route is located in `src/main/resources/routes` as an XML file.
+
+This example has been enabled with live reload, so while the Camel
+application is running, then you can edit the route in the XML file,
+and when saved Camel will auto update the route(s).
+
+The application is configured in the `application.properties` file.
 
 === How to run
 
diff --git a/examples/main-xml/src/main/data/foo.properties b/examples/main-xml/src/main/data/foo.properties
deleted file mode 100644
index b43e6bc..0000000
--- a/examples/main-xml/src/main/data/foo.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-bye = Bye
\ No newline at end of file
diff --git a/examples/main-xml/src/main/java/org/apache/camel/example/MyApplication.java b/examples/main-xml/src/main/java/org/apache/camel/example/MyApplication.java
index cb12fc8..0476b5f 100644
--- a/examples/main-xml/src/main/java/org/apache/camel/example/MyApplication.java
+++ b/examples/main-xml/src/main/java/org/apache/camel/example/MyApplication.java
@@ -34,6 +34,10 @@ public final class MyApplication {
         main.configure().addConfigurationClass(MyConfiguration.class);
         // and add all the XML routes
         main.configure().withRoutesIncludePattern("routes/*.xml");
+        // turn on reloading routes on code-changes
+        main.configure().withRoutesReloadEnabled(true);
+        main.configure().withRoutesReloadDirectory("src/main/resources");
+        main.configure().withRoutesReloadPattern("routes/*.xml");
 
         // now keep the application running until the JVM is terminated (ctrl + c or sigterm)
         main.run(args);
diff --git a/examples/main-xml/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/main-xml/src/main/java/org/apache/camel/example/MyRouteBuilder.java
deleted file mode 100644
index c2a1983..0000000
--- a/examples/main-xml/src/main/java/org/apache/camel/example/MyRouteBuilder.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 org.apache.camel.builder.RouteBuilder;
-
-public class MyRouteBuilder extends RouteBuilder {
-
-    @Override
-    public void configure() throws Exception {
-        from("quartz:foo?cron={{myCron}}")
-            .bean("myBean", "hello")
-            .log("${body}")
-            .bean("myBean", "bye")
-            .log("${body}");
-    }
-}
diff --git a/examples/main-xml/src/main/resources/application.properties b/examples/main-xml/src/main/resources/application.properties
index 242773d..74c10c0 100644
--- a/examples/main-xml/src/main/resources/application.properties
+++ b/examples/main-xml/src/main/resources/application.properties
@@ -17,45 +17,23 @@
 
 # to configure camel main
 # here you can configure options on camel main (see MainConfigurationProperties class)
-camel.main.name = MyCoolCamel
-camel.main.jmx-enabled = false
+camel.main.name = MyXmlCamel
 
-# extended runtime statistics about bean introspection usage (java reflection)
-# camel.main.bean-introspection-extended-statistics=true
-# camel.main.bean-introspection-logging-level=INFO
-
-# enable tracing
-# camel.main.tracing = true
-# configure tracing what to include from the exchange
-#camel.context.tracer.exchange-formatter.show-exchange-id = false
-#camel.context.tracer.exchange-formatter.show-headers = true
-#camel.context.tracer.exchange-formatter.show-body-type = false
-
-# you can also configure camel context directly
-# camel.context.shutdown-strategy.shutdown-now-on-timeout = false
-
-# load additional property placeholders from this folder
-camel.main.file-configurations=src/main/data/*.properties
+# turn on route reloading on file changes
+camel.main.routes-reload-enabled = true
+# the base directory to watch
+camel.main.routes-reload-directory = src/main/resources
+# pattern(s) for files to watch
+camel.main.routes-reload-pattern = routes/*.xml
 
 # to configure the camel quartz component
 # here we can configure the options on the component level (and we can use dash-naming-style)
 camel.component.quartz.start-delayed-seconds = 3
 
-# to configure Hystrix EIP (global and you need to add camel-hystrix to the classpath)
-### camel.hystrix.group-key=myGroup
-### camel.hystrix.execution-timeout-in-milliseconds=5000
-
-# to configure Rest DSL (global and you need to add camel-undertow to the classpath)
-### camel.rest.component=undertow
-### camel.rest.port=8080
-### camel.rest.component-properties[host-options.buffer-size]=8192
-
-# you can configure whether OS environment should override (=2 which is default) or as fallback (=1)
-### camel.component.properties.environment-variable-mode=1
-
 # properties used in the route
 myCron = 0/2 * * * * ?
 
 # application properties
 hi = Hello
+bye = Bye
 
diff --git a/examples/main-xml/src/main/resources/routes/my-route.xml b/examples/main-xml/src/main/resources/routes/my-route.xml
index 43d71c4..0d9c1c2 100644
--- a/examples/main-xml/src/main/resources/routes/my-route.xml
+++ b/examples/main-xml/src/main/resources/routes/my-route.xml
@@ -18,7 +18,7 @@
 
 -->
 <routes id="camel" xmlns="http://camel.apache.org/schema/spring">
-    <route>
+    <route id="foo">
         <from uri="quartz:foo?cron={{myCron}}"/>
         <bean ref="myBean" method="hello"/>
         <log message="${body}"/>

[camel-examples] 05/05: Regen

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4a4d55eb7472df6bda10dafbce6806954ac11fb9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 10:59:35 2021 +0100

    Regen
---
 examples/README.adoc | 4 +++-
 examples/pom.xml     | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/README.adoc b/examples/README.adoc
index 5b304b7..f80f23d 100644
--- a/examples/README.adoc
+++ b/examples/README.adoc
@@ -11,7 +11,7 @@ View the individual example READMEs for details.
 == Examples
 
 // examples: START
-Number of Examples: 96 (0 deprecated)
+Number of Examples: 97 (0 deprecated)
 
 [width="100%",cols="4,2,4",options="header"]
 |===
@@ -81,6 +81,8 @@ Number of Examples: 96 (0 deprecated)
 
 | link:main-xml/README.adoc[Main Xml] (main-xml) | Beginner | An example for showing standalone Camel using XML
 
+| link:main-yaml/README.adoc[Main Yaml] (main-yaml) | Beginner | An example for showing standalone Camel using YAML
+
 | link:oaipmh/README.adoc[OAIPMH example] (oaipmh) | Beginner | An example with OAIPMH component
 
 | link:pojo-messaging/README.adoc[POJO Routing] (pojo-messaging) | Beginner | An example showing how to produce and consume messages from Camel endpoints using annotated POJOs
diff --git a/examples/pom.xml b/examples/pom.xml
index 2c2a068..1c462e4 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -138,6 +138,7 @@
         <module>main-lambda</module>
         <module>main-tiny</module>
         <module>main-xml</module>
+        <module>main-yaml</module>
         <module>management</module>
         <module>micrometer</module>
         <module>mongodb</module>

[camel-examples] 04/05: Fixed example

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c31a82b295186b7d83e63f916e4a72d5f29fea3e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 10:59:28 2021 +0100

    Fixed example
---
 .../src/main/java/org/apache/camel/example/cdi/xml/Application.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java b/examples/cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
index 5a741cc..19ea6d4 100644
--- a/examples/cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
+++ b/examples/cdi-xml/src/main/java/org/apache/camel/example/cdi/xml/Application.java
@@ -25,6 +25,7 @@ import javax.inject.Named;
 
 import org.apache.camel.Body;
 import org.apache.camel.CamelException;
+import org.apache.camel.Exchange;
 import org.apache.camel.Handler;
 import org.apache.camel.Processor;
 import org.apache.camel.cdi.ImportResource;
@@ -50,7 +51,7 @@ public class Application {
     @Named
     @Produces
     Processor tracer = exchange -> exchange.getIn()
-        .setHeader("location", simple("${exchangeProperty.CamelFailureRouteId}"));
+        .setHeader("location", exchange.getProperty(Exchange.FAILURE_ROUTE_ID));
 
     void login(@Observes @Initialized(ApplicationScoped.class) Object event) {
         System.out.println(

[camel-examples] 03/05: CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2957de588cb86bf05edd07a38d6791b3d494e7c2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 09:39:46 2021 +0100

    CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
---
 .../src/main/resources/application.properties      |  3 ++
 .../org/apache/camel/example/MyApplication.java    |  4 +--
 .../src/main/resources/routes/my-route.yaml        | 35 +++++++++++++++-------
 3 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/examples/main-xml/src/main/resources/application.properties b/examples/main-xml/src/main/resources/application.properties
index 74c10c0..ee9f831 100644
--- a/examples/main-xml/src/main/resources/application.properties
+++ b/examples/main-xml/src/main/resources/application.properties
@@ -19,6 +19,9 @@
 # here you can configure options on camel main (see MainConfigurationProperties class)
 camel.main.name = MyXmlCamel
 
+# load XML routes
+camel.main.routes-include-pattern = routes/*.xml
+
 # turn on route reloading on file changes
 camel.main.routes-reload-enabled = true
 # the base directory to watch
diff --git a/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java b/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java
index 4396bb7..04d2b8a 100644
--- a/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java
+++ b/examples/main-yaml/src/main/java/org/apache/camel/example/MyApplication.java
@@ -32,8 +32,8 @@ public final class MyApplication {
         // lets use a configuration class (you can specify multiple classes)
         // (properties are automatic loaded from application.properties)
         main.configure().addConfigurationClass(MyConfiguration.class);
-        // and add all the XML routes
-        main.configure().withRoutesIncludePattern("routes/*.xml");
+        // and add all the YAML routes
+        main.configure().withRoutesIncludePattern("routes/*.yaml");
         // turn on reloading routes on code-changes
         main.configure().withRoutesReloadEnabled(true);
         main.configure().withRoutesReloadDirectory("src/main/resources");
diff --git a/examples/main-yaml/src/main/resources/routes/my-route.yaml b/examples/main-yaml/src/main/resources/routes/my-route.yaml
index 0abd0ac..4ca6635 100644
--- a/examples/main-yaml/src/main/resources/routes/my-route.yaml
+++ b/examples/main-yaml/src/main/resources/routes/my-route.yaml
@@ -1,10 +1,25 @@
-from:
-  route-id: "foo"
-  uri: "quartz:foo"
-  parameters:
-    cron: "{{period}}"
-  steps:
-    - to: "bean:myBean.hello"
-    - log: "${body}"
-    - to: "bean:myBean.bye"
-    - log: "${body}"
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+    id: "foo"
+    from: "quartz:foo?cron={{myCron}}"
+    steps:
+      - to: "bean:myBean?method=hello"
+      - log: "${body}"
+      - to: "bean:myBean?method=bye"
+      - log: "${body}"