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 10:00:00 UTC
[camel-examples] 03/05: CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
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}"