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 2022/05/16 10:08:49 UTC

[camel-kamelets-examples] branch main updated: CAMEL-18115: Add endpoint-dsl example

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 c3aaf70  CAMEL-18115: Add endpoint-dsl example
c3aaf70 is described below

commit c3aaf70c7d436e7c515c571a1c19452c9b0eeb66
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon May 16 12:08:43 2022 +0200

    CAMEL-18115: Add endpoint-dsl example
---
 jbang/hello-endpoint-dsl/Hey.java    | 10 ++++
 jbang/hello-endpoint-dsl/README.adoc | 96 ++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)

diff --git a/jbang/hello-endpoint-dsl/Hey.java b/jbang/hello-endpoint-dsl/Hey.java
new file mode 100755
index 0000000..d06ff33
--- /dev/null
+++ b/jbang/hello-endpoint-dsl/Hey.java
@@ -0,0 +1,10 @@
+public class Hey extends org.apache.camel.builder.endpoint.EndpointRouteBuilder {
+
+  @Override
+  public void configure() throws Exception {
+      // Write your routes here, for example:
+      from(timer("java").period(1000))
+        .setBody(constant("Hello World"))
+        .log("${body}");
+  }
+}
diff --git a/jbang/hello-endpoint-dsl/README.adoc b/jbang/hello-endpoint-dsl/README.adoc
new file mode 100644
index 0000000..0ffaedd
--- /dev/null
+++ b/jbang/hello-endpoint-dsl/README.adoc
@@ -0,0 +1,96 @@
+== Hello Endpoint DSL with Java
+
+This example is a hello world example to run a Java route (type safe with endpoint-dsl) with Camel JBang.
+
+=== Install JBang
+
+First install JBang according to https://www.jbang.dev
+
+When JBang is installed then you should be able to run from a shell:
+
+[source,sh]
+----
+$ jbang --version
+----
+
+This will output the version of JBang.
+
+To run this example you can either install Camel on JBang via:
+
+[source,sh]
+----
+$ jbang app install camel@apache/camel
+----
+
+Which allows to run CamelJBang with `camel` as shown below.
+
+=== How to run
+
+Then you can run this example using:
+
+[source,sh]
+----
+$ camel run Hey.java
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run Hey.java
+----
+
+=== Run directly from github
+
+The example can also be run directly by referring to the github URL as shown:
+
+[source,sh]
+----
+$ jbang camel@apache/camel run https://github.com/apache/camel-kamelets-examples/tree/main/jbang/hello-endpoint-dsl
+----
+
+You can even try other examples such as the polyglot example from Camel K:
+
+[source,sh]
+----
+$ jbang camel@apache/camel run https://github.com/apache/camel-k/tree/main/examples/polyglot
+----
+
+Or the Kotlin route(s) (you can use wildcards):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run https://github.com/apache/camel-k/tree/main/examples/languages/*.kts
+----
+
+=== Live reload
+
+You can run the example in dev mode which allows you to edit the example,
+and hot-reload when the file is saved.
+
+[source,sh]
+----
+$ camel run Hey.java --dev
+----
+
+=== Developer Web Console
+
+You can enable the developer console via `--console` flag as show:
+
+[source,sh]
+----
+$ camel run Hey.java --console
+----
+
+Then you can browse: http://localhost:8080/q/dev to introspect the running Camel applicaton.
+
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!