You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gg...@apache.org on 2023/06/30 09:46:40 UTC

[camel-kamelets-examples] 01/02: Add example that includes more elements under top-level element

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

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

commit d4f46e1f4965f00cb2c2509893d43d9b5a3838ec
Author: Grzegorz Grzybek <gr...@gmail.com>
AuthorDate: Fri Jun 30 09:54:42 2023 +0200

    Add example that includes more <route> elements under top-level <camel> element
---
 jbang/app-routes/README.adoc | 85 ++++++++++++++++++++++++++++++++++++++++++++
 jbang/app-routes/app.xml     | 21 +++++++++++
 2 files changed, 106 insertions(+)

diff --git a/jbang/app-routes/README.adoc b/jbang/app-routes/README.adoc
new file mode 100644
index 0000000..633b755
--- /dev/null
+++ b/jbang/app-routes/README.adoc
@@ -0,0 +1,85 @@
+== Hello Java
+
+This example shows convenient way to include more routes in one XML file under special `<camel>` root element.
+This allows to declare more routes, rests, route configurations and templates in single XML file.
+
+Camel 4 is required.
+
+=== 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 app.xml
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run app.xml
+----
+
+=== 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 app.xml --dev
+----
+
+=== 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/app-routes
+----
+
+=== Developer Web Console
+
+You can enable the developer console via `--console` flag as show:
+
+[source,sh]
+----
+$ camel run app.xml --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!
diff --git a/jbang/app-routes/app.xml b/jbang/app-routes/app.xml
new file mode 100644
index 0000000..79f18e4
--- /dev/null
+++ b/jbang/app-routes/app.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<camel>
+
+    <route id="r1">
+        <from uri="timer:xml?period={{time:1200}}"/>
+        <setBody>
+            <simple>Hello Camel from ${routeId}</simple>
+        </setBody>
+        <log message="${body}"/>
+    </route>
+
+    <route id="r2">
+        <from uri="timer:xml?period={{time:1300}}"/>
+        <setBody>
+            <simple>Hello Camel from ${routeId}</simple>
+        </setBody>
+        <log message="${body}"/>
+    </route>
+
+</camel>