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


The following commit(s) were added to refs/heads/main by this push:
     new 6613772  CAMEL-16757: Update example
6613772 is described below

commit 6613772303b6054754de88da3ffd076a206fda1a
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Aug 3 08:52:50 2021 +0200

    CAMEL-16757: Update example
---
 examples/routes-configuration/pom.xml                              | 7 +------
 .../src/main/java/org/apache/camel/example/MyApplication.java      | 5 ++---
 .../org/apache/camel/example/MyJavaErrorHandler.java}              | 7 ++++++-
 .../org/apache/camel/example}/MyJavaRouteBuilder.java              | 4 +++-
 .../src/main/resources/myroutes/my-xml-route.xml                   | 2 +-
 .../src/main/resources/myroutes/my-yaml-route.yaml                 | 2 +-
 6 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/examples/routes-configuration/pom.xml 
b/examples/routes-configuration/pom.xml
index 980c10f..0f7767b 100644
--- a/examples/routes-configuration/pom.xml
+++ b/examples/routes-configuration/pom.xml
@@ -56,11 +56,6 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-main</artifactId>
         </dependency>
-        <!-- joor with java route loader -->
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-java-joor-dsl</artifactId>
-        </dependency>
         <!-- xml-io with fast xml route loader -->
         <dependency>
             <groupId>org.apache.camel</groupId>
@@ -119,7 +114,7 @@
                 <version>${camel.version}</version>
                 <configuration>
                     <logClasspath>false</logClasspath>
-                    <mainClass>org.apache.camel.main.Main</mainClass>
+                    
<mainClass>org.apache.camel.example.MyApplication</mainClass>
                 </configuration>
             </plugin>
         </plugins>
diff --git 
a/examples/routes-configuration/src/main/java/org/apache/camel/example/MyApplication.java
 
b/examples/routes-configuration/src/main/java/org/apache/camel/example/MyApplication.java
index 6de6397..e4acfae 100644
--- 
a/examples/routes-configuration/src/main/java/org/apache/camel/example/MyApplication.java
+++ 
b/examples/routes-configuration/src/main/java/org/apache/camel/example/MyApplication.java
@@ -20,9 +20,6 @@ import org.apache.camel.main.Main;
 
 /**
  * Main class that boot the Camel application.
- *
- * This class has been added to make it easy to run the application from a 
Java editor.
- * However you can start this application by running 
org.apache.camel.main.Main directory (see Maven pom.xml)
  */
 public final class MyApplication {
 
@@ -32,6 +29,8 @@ public final class MyApplication {
     public static void main(String[] args) throws Exception {
         // use Camels Main class
         Main main = new Main();
+        // add Java route classes
+        main.configure().addRoutesBuilder(MyJavaRouteBuilder.class, 
MyJavaErrorHandler.class);
         // now keep the application running until the JVM is terminated (ctrl 
+ c or sigterm)
         main.run(args);
     }
diff --git 
a/examples/routes-configuration/src/main/resources/myerror/JavaErrorHandler.java
 
b/examples/routes-configuration/src/main/java/org/apache/camel/example/MyJavaErrorHandler.java
similarity index 87%
rename from 
examples/routes-configuration/src/main/resources/myerror/JavaErrorHandler.java
rename to 
examples/routes-configuration/src/main/java/org/apache/camel/example/MyJavaErrorHandler.java
index 86db575..16c91ae 100644
--- 
a/examples/routes-configuration/src/main/resources/myerror/JavaErrorHandler.java
+++ 
b/examples/routes-configuration/src/main/java/org/apache/camel/example/MyJavaErrorHandler.java
@@ -14,9 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.camel.example;
+
 import org.apache.camel.builder.RouteConfigurationBuilder;
 
-public class JavaErrorHandler extends RouteConfigurationBuilder {
+/**
+ * Route configuration for error handling.
+ */
+public class MyJavaErrorHandler extends RouteConfigurationBuilder {
 
     @Override
     public void configuration() throws Exception {
diff --git 
a/examples/routes-configuration/src/main/resources/myroutes/MyJavaRouteBuilder.java
 
b/examples/routes-configuration/src/main/java/org/apache/camel/example/MyJavaRouteBuilder.java
similarity index 94%
rename from 
examples/routes-configuration/src/main/resources/myroutes/MyJavaRouteBuilder.java
rename to 
examples/routes-configuration/src/main/java/org/apache/camel/example/MyJavaRouteBuilder.java
index 220f548..9d688c7 100644
--- 
a/examples/routes-configuration/src/main/resources/myroutes/MyJavaRouteBuilder.java
+++ 
b/examples/routes-configuration/src/main/java/org/apache/camel/example/MyJavaRouteBuilder.java
@@ -14,6 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.camel.example;
+
 import java.util.Random;
 
 import org.apache.camel.builder.RouteBuilder;
@@ -24,7 +26,7 @@ public class MyJavaRouteBuilder extends RouteBuilder {
     public void configure() throws Exception {
         from("timer:java?period=2s")
             // refer to the route configuration by the id to use for this route
-            .routeConfiguration("javaError")
+            .routeConfigurationId("javaError")
             .setBody(method(MyJavaRouteBuilder.class, "randomNumber"))
             .log("Random number ${body}")
             .filter(simple("${body} < 30"))
diff --git 
a/examples/routes-configuration/src/main/resources/myroutes/my-xml-route.xml 
b/examples/routes-configuration/src/main/resources/myroutes/my-xml-route.xml
index f59a027..a098857 100644
--- a/examples/routes-configuration/src/main/resources/myroutes/my-xml-route.xml
+++ b/examples/routes-configuration/src/main/resources/myroutes/my-xml-route.xml
@@ -24,7 +24,7 @@
 -->
 
 <!-- refer to the route configuration by the id to use for this route -->
-<route routeConfiguration="xmlError">
+<route routeConfigurationId="xmlError">
     <from uri="timer:xml?period=5s"/>
     <log message="I am XML"/>
     <throwException exceptionType="java.lang.Exception" message="Some kind of 
XML error"/>
diff --git 
a/examples/routes-configuration/src/main/resources/myroutes/my-yaml-route.yaml 
b/examples/routes-configuration/src/main/resources/myroutes/my-yaml-route.yaml
index 6876dac..8816956 100644
--- 
a/examples/routes-configuration/src/main/resources/myroutes/my-yaml-route.yaml
+++ 
b/examples/routes-configuration/src/main/resources/myroutes/my-yaml-route.yaml
@@ -17,7 +17,7 @@
 
 - route:
     # refer to the route configuration by the id to use for this route
-    route-configuration: "yamlError"
+    route-configuration-id: "yamlError"
     from: "timer:yaml?period=3s"
     steps:
       - set-body:

Reply via email to