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/10/27 11:38:59 UTC
[camel-kamelets-examples] branch main updated: Camel K CRD example with inlined java source code.
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 3472cfb Camel K CRD example with inlined java source code.
3472cfb is described below
commit 3472cfbee0bba470ba5455e13645cba68af12ae0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Oct 27 13:38:40 2022 +0200
Camel K CRD example with inlined java source code.
---
jbang/camelk-bean/README.adoc | 83 +++++++++++++++++++++++++++++++++++++++++++
jbang/camelk-bean/echo.yaml | 26 ++++++++++++++
2 files changed, 109 insertions(+)
diff --git a/jbang/camelk-bean/README.adoc b/jbang/camelk-bean/README.adoc
new file mode 100644
index 0000000..979f3bc
--- /dev/null
+++ b/jbang/camelk-bean/README.adoc
@@ -0,0 +1,83 @@
+== Camel K with embedded Java bean
+
+This example is a Camel K integration CRD file that has inlined a Java bean as source code,
+which can be used by Camel route in YAML DSL.
+
+=== 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 echo.yaml
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run echo.yaml
+----
+
+=== 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/camelk-bean
+----
+
+=== 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 echo.yaml --dev
+----
+
+=== Developer Web Console
+
+You can enable the developer console via `--console` flag as show:
+
+[source,sh]
+----
+$ camel run echo.yaml --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/camelk-bean/echo.yaml b/jbang/camelk-bean/echo.yaml
new file mode 100644
index 0000000..9794749
--- /dev/null
+++ b/jbang/camelk-bean/echo.yaml
@@ -0,0 +1,26 @@
+apiVersion: camel.apache.org/v1
+kind: Integration
+metadata:
+ name: echo
+spec:
+ sources:
+ - content: |
+ // using package names is not supported so the class is in root package
+ @org.apache.camel.BindToRegistry("echo")
+ public class MyEchoBean {
+ public String echo(String body) {
+ return body + body;
+ }
+ }
+ name: MyEchoBean.java
+ flows:
+ - from:
+ uri: "timer:yaml"
+ parameters:
+ period: "1000"
+ steps:
+ - setBody:
+ constant: "HelloWorld"
+ - setBody:
+ simple: "${bean:echo}"
+ - log: "${body}"