You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2022/04/18 09:09:13 UTC

[camel-k] 02/04: updated service to use a nodeport

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

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

commit 15db50fccd55b22d6959f7993d95b63a08626c51
Author: gre8t <ak...@gmail.com>
AuthorDate: Tue Apr 5 14:46:33 2022 +0100

    updated service to use a nodeport
---
 examples/traits/service/service.java | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/examples/traits/service/service.java b/examples/traits/service/service.java
index 22064fcd8..f7ccc48c6 100644
--- a/examples/traits/service/service.java
+++ b/examples/traits/service/service.java
@@ -15,15 +15,23 @@
  * limitations under the License.
  */
 
-//kamel run --trait service.enabled=true
+//
+// To run this integrations use:
+//
+//     kamel run service.java --trait service.enabled=true\
+//     --trait service.node-port=true
+//
+import org.apache.camel.Exchange;
 
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.example.MyClass;
+public class RestDSL extends org.apache.camel.builder.RouteBuilder {
+    @Override
+    public void configure() throws Exception {
+        rest()
+            .get("/hello")
+            .to("direct:hello");
 
-public class Classpath extends RouteBuilder {
-  @Override
-  public void configure() throws Exception {
-	  from("timer:tick")
-        .log(MyClass.sayHello());
-  }
-}
\ No newline at end of file
+        from("direct:hello")
+            .setHeader(Exchange.CONTENT_TYPE, constant("text/plain"))
+            .transform().simple("Hello World");
+    }
+}