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 10e8ced Add local kamelet example 10e8ced is described below commit 10e8cedbe0f857c6767b8b610e0a91c1f447fec5 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Jun 26 09:12:53 2024 +0200 Add local kamelet example --- jbang/custom-kamelet-local/README.adoc | 67 ++++++++++++++++++++++ jbang/custom-kamelet-local/route.camel.yaml | 11 ++++ .../custom-kamelet-local/wine-source.kamelet.yaml | 33 +++++++++++ 3 files changed, 111 insertions(+) diff --git a/jbang/custom-kamelet-local/README.adoc b/jbang/custom-kamelet-local/README.adoc new file mode 100644 index 0000000..552a34b --- /dev/null +++ b/jbang/custom-kamelet-local/README.adoc @@ -0,0 +1,67 @@ +== Custom Kamelet local + +This example is using a custom Kamelet that fetches wine data. + +The custom kamelets are locally co-located with the Camel routes, +so you can easily edit your kamelet and run and test using a route +using the kamelet, all together in the same folder. + +=== 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 * +---- + +==== Run in dev mode for hot-reload + +You can run in dev mode, which allows you to edit the source files and hot-reload changes. + +[source,sh] +---- +$ camel run * --dev +---- + +=== Run directly from GitHub + +The example can also be run directly by referring to the GitHub URL as shown: + +[source,sh] +---- +$ camel run https://github.com/apache/camel-kamelets-examples/tree/main/jbang/custom-kamelet-local +---- + + +=== 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/custom-kamelet-local/route.camel.yaml b/jbang/custom-kamelet-local/route.camel.yaml new file mode 100644 index 0000000..d3907fb --- /dev/null +++ b/jbang/custom-kamelet-local/route.camel.yaml @@ -0,0 +1,11 @@ +# camel-k: language=yaml + +# Write your routes here, for example: +- from: + uri: "kamelet:wine-source" + parameters: + period: "3000" + steps: + - setBody: + simple: "Is this wine '${body}' good?" + - log: "${body}" diff --git a/jbang/custom-kamelet-local/wine-source.kamelet.yaml b/jbang/custom-kamelet-local/wine-source.kamelet.yaml new file mode 100644 index 0000000..76e55a7 --- /dev/null +++ b/jbang/custom-kamelet-local/wine-source.kamelet.yaml @@ -0,0 +1,33 @@ +apiVersion: camel.apache.org/v1 +kind: Kamelet +metadata: + name: wine-source + labels: + camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "Wine Example" + description: "Produces periodic events with a wine payload" + required: + - message + properties: + period: + title: Period + description: The time interval between two events + type: integer + default: 5000 + types: + out: + mediaType: text/plain + template: + from: + uri: timer:tick + parameters: + period: "{{period}}" + steps: + - setBody: + constant: "2021 Amarone della Valpolicella Castel del Lago" + - setHeader: + name: "Content-Type" + constant: "text/plain" + - to: "kamelet:sink"