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 3962117 Add beginner examples
3962117 is described below
commit 39621179406a2da5b396a77bbfd0a88a165cc145
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Aug 27 09:32:55 2022 +0200
Add beginner examples
---
jbang/hello-java/README.adoc | 28 ++++++----------------
jbang/{hello-java => hello-xml}/README.adoc | 36 +++++++++-------------------
jbang/hello-xml/hi.xml | 19 +++++++++++++++
jbang/{hello-java => hello-yaml}/README.adoc | 28 ++++++----------------
jbang/hello-yaml/hello.yaml | 11 +++++++++
5 files changed, 55 insertions(+), 67 deletions(-)
diff --git a/jbang/hello-java/README.adoc b/jbang/hello-java/README.adoc
index 05099ee..8e36b02 100644
--- a/jbang/hello-java/README.adoc
+++ b/jbang/hello-java/README.adoc
@@ -40,37 +40,23 @@ Or run with JBang using the longer command line (without
installing camel as app
$ 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-java
-----
-
-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
-----
+=== Live reload
-Or the Kotlin route(s) (you can use wildcards):
+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]
----
-$ jbang camel@apache/camel run
https://github.com/apache/camel-k/tree/main/examples/languages/*.kts
+$ camel run Hey.java --dev
----
-=== Live reload
+=== Run directly from github
-You can run the example in dev mode which allows you to edit the example,
-and hot-reload when the file is saved.
+The example can also be run directly by referring to the github URL as shown:
[source,sh]
----
-$ camel run Hey.java --dev
+$ jbang camel@apache/camel run
https://github.com/apache/camel-kamelets-examples/tree/main/jbang/hello-java
----
=== Developer Web Console
diff --git a/jbang/hello-java/README.adoc b/jbang/hello-xml/README.adoc
similarity index 70%
copy from jbang/hello-java/README.adoc
copy to jbang/hello-xml/README.adoc
index 05099ee..4c38aeb 100644
--- a/jbang/hello-java/README.adoc
+++ b/jbang/hello-xml/README.adoc
@@ -1,6 +1,6 @@
== Hello Java
-This example is a hello world example to run a Java route with Camel JBang.
+This example is a hello world example to run a XML route with Camel JBang.
=== Install JBang
@@ -30,47 +30,33 @@ Then you can run this example using:
[source,sh]
----
-$ camel run Hey.java
+$ camel run hi.xml
----
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
+$ jbang camel@apache/camel run hi.xml
----
-=== 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-java
-----
-
-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
-----
+=== Live reload
-Or the Kotlin route(s) (you can use wildcards):
+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]
----
-$ jbang camel@apache/camel run
https://github.com/apache/camel-k/tree/main/examples/languages/*.kts
+$ camel run hi.xml --dev
----
-=== Live reload
+=== Run directly from github
-You can run the example in dev mode which allows you to edit the example,
-and hot-reload when the file is saved.
+The example can also be run directly by referring to the github URL as shown:
[source,sh]
----
-$ camel run Hey.java --dev
+$ jbang camel@apache/camel run
https://github.com/apache/camel-kamelets-examples/tree/main/jbang/hello-xml
----
=== Developer Web Console
@@ -79,7 +65,7 @@ You can enable the developer console via `--console` flag as
show:
[source,sh]
----
-$ camel run Hey.java --console
+$ camel run hi.xml --console
----
Then you can browse: http://localhost:8080/q/dev to introspect the running
Camel applicaton.
diff --git a/jbang/hello-xml/hi.xml b/jbang/hello-xml/hi.xml
new file mode 100644
index 0000000..290384f
--- /dev/null
+++ b/jbang/hello-xml/hi.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- camel-k: language=xml -->
+
+<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+ http://camel.apache.org/schema/spring
+ https://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <!-- Write your routes here, for example: -->
+ <route id="xml">
+ <from uri="timer:xml?period={{time:1000}}"/>
+ <setBody>
+ <simple>Hello Camel from ${routeId}</simple>
+ </setBody>
+ <log message="${body}"/>
+ </route>
+
+</routes>
diff --git a/jbang/hello-java/README.adoc b/jbang/hello-yaml/README.adoc
similarity index 70%
copy from jbang/hello-java/README.adoc
copy to jbang/hello-yaml/README.adoc
index 05099ee..ad18134 100644
--- a/jbang/hello-java/README.adoc
+++ b/jbang/hello-yaml/README.adoc
@@ -1,6 +1,6 @@
-== Hello Java
+== Hello YAML
-This example is a hello world example to run a Java route with Camel JBang.
+This example is a hello world example to run YAML route with Camel JBang.
=== Install JBang
@@ -30,14 +30,14 @@ Then you can run this example using:
[source,sh]
----
-$ camel run Hey.java
+$ camel run hello.yaml
----
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
+$ jbang camel@apache/camel run hello.yaml
----
=== Run directly from github
@@ -46,21 +46,7 @@ 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-java
-----
-
-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
+$ jbang camel@apache/camel run
https://github.com/apache/camel-kamelets-examples/tree/main/jbang/hello-yaml
----
=== Live reload
@@ -70,7 +56,7 @@ and hot-reload when the file is saved.
[source,sh]
----
-$ camel run Hey.java --dev
+$ camel run hello.yaml --dev
----
=== Developer Web Console
@@ -79,7 +65,7 @@ You can enable the developer console via `--console` flag as
show:
[source,sh]
----
-$ camel run Hey.java --console
+$ camel run hello.yaml --console
----
Then you can browse: http://localhost:8080/q/dev to introspect the running
Camel applicaton.
diff --git a/jbang/hello-yaml/hello.yaml b/jbang/hello-yaml/hello.yaml
new file mode 100644
index 0000000..ba311b9
--- /dev/null
+++ b/jbang/hello-yaml/hello.yaml
@@ -0,0 +1,11 @@
+# camel-k: language=yaml
+
+# Write your routes here, for example:
+- from:
+ uri: "timer:yaml"
+ parameters:
+ period: "1000"
+ steps:
+ - setBody:
+ constant: "Hello Camel from yaml"
+ - log: "${body}"