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 2024/04/29 07:32:41 UTC

(camel-kamelets-examples) branch main updated: Polished example to use java

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-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new a04311d  Polished example to use java
a04311d is described below

commit a04311da207aed3a2cf6ffe566c9adf3d9261215
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 29 09:13:11 2024 +0200

    Polished example to use java
---
 jbang/open-api/{greetings.groovy => Greetings.java} | 16 +++++++++++-----
 jbang/open-api/README.md                            |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/jbang/open-api/greetings.groovy b/jbang/open-api/Greetings.java
similarity index 71%
rename from jbang/open-api/greetings.groovy
rename to jbang/open-api/Greetings.java
index 7d20bdb..91ee42f 100644
--- a/jbang/open-api/greetings.groovy
+++ b/jbang/open-api/Greetings.java
@@ -1,4 +1,3 @@
-// camel-k: language=groovy
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -16,7 +15,14 @@
  * limitations under the License.
  */
 
-from('direct:greeting-api')
-    .to('log:api?showAll=true&multiline=true') 
-    .setBody()
-        .simple('Hello from ${headers.name}')
+import org.apache.camel.builder.RouteBuilder;
+
+public class Greetings extends RouteBuilder {
+
+    public void configure() throws Exception {
+        from("direct:greeting-api")
+            .to("log:api?showAll=true&multiline=true") 
+            .setBody()
+                .simple("Hello from ${headers.name}");  
+    }    
+}
diff --git a/jbang/open-api/README.md b/jbang/open-api/README.md
index b81b253..a8606a9 100644
--- a/jbang/open-api/README.md
+++ b/jbang/open-api/README.md
@@ -7,7 +7,7 @@ Find useful examples about how to expose an Open API specification in a Camel in
 Run the examples running
 
 ```
-camel run --open-api greetings-api.json greetings.groovy
+camel run --open-api greetings-api.json Greetings.java
 ```
 
 Then you can test by calling the hello endpoint, ie: