You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/03/18 11:07:50 UTC

[camel-quarkus-examples] 01/02: Enable rest-json example to work with Camel 3.16

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

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

commit b9387318009f14b2f9da903da67e52d87e6aa795
Author: James Netherton <ja...@gmail.com>
AuthorDate: Fri Mar 18 10:00:25 2022 +0000

    Enable rest-json example to work with Camel 3.16
---
 rest-json/pom.xml                                  |  4 ++++
 .../src/main/java/org/acme/rest/json/Routes.java   | 23 ++++++++++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/rest-json/pom.xml b/rest-json/pom.xml
index 55e454d..026553e 100644
--- a/rest-json/pom.xml
+++ b/rest-json/pom.xml
@@ -81,6 +81,10 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-rest</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
 
         <!-- test dependencies -->
         <dependency>
diff --git a/rest-json/src/main/java/org/acme/rest/json/Routes.java b/rest-json/src/main/java/org/acme/rest/json/Routes.java
index d6021d8..d2a5f3a 100644
--- a/rest-json/src/main/java/org/acme/rest/json/Routes.java
+++ b/rest-json/src/main/java/org/acme/rest/json/Routes.java
@@ -48,21 +48,24 @@ public class Routes extends RouteBuilder {
 
         rest("/fruits")
                 .get()
-                .route()
-                .setBody().constant(fruits)
-                .endRest()
+                .to("direct:getFruits")
 
                 .post()
                 .type(Fruit.class)
-                .route()
-                .process().body(Fruit.class, fruits::add)
-                .setBody().constant(fruits)
-                .endRest();
+                .to("direct:addFruit");
 
         rest("/legumes")
                 .get()
-                .route()
-                .setBody().constant(legumes)
-                .endRest();
+                .to("direct:getLegumes");
+
+        from("direct:getFruits")
+                .setBody().constant(fruits);
+
+        from("direct:addFruit")
+                .process().body(Fruit.class, fruits::add)
+                .setBody().constant(fruits);
+
+        from("direct:getLegumes")
+                .setBody().constant(legumes);
     }
 }