From 82067e610c050480d1bad919633e466c088216b9 Mon Sep 17 00:00:00 2001 From: Tadayoshi Sato Date: Tue, 28 Apr 2020 13:27:18 +0900 Subject: [PATCH] doc: update readme --- README.md | 63 ++++++++++++++++++++++++++++++++++++++++++++++------- kernel.json | 2 +- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 342a36e..421c593 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,64 @@ This kernel enables you to run [Apache Camel](https://camel.apache.org/) routes - [Jupyter](https://jupyter.org/install) - Java >= 11 -## Supported route languages +## Supported Camel route languages -Currently only [JavaScript](https://camel.apache.org/camel-k/latest/languages/javascript.html) is supported. +All [route languages](https://camel.apache.org/camel-k/latest/languages/languages.html) supported by [Camel K](https://camel.apache.org/camel-k/latest/index.html) except YAML are supported by ICamel. See the following links to learn how to write a Camel route with each language. -## Installing +- [Groovy](https://camel.apache.org/camel-k/latest/languages/groovy.html) +- [Kotlin](https://camel.apache.org/camel-k/latest/languages/kotlin.html) +- [JavaScript](https://camel.apache.org/camel-k/latest/languages/javascript.html) +- [Java](https://camel.apache.org/camel-k/latest/languages/java.html) +- [XML](https://camel.apache.org/camel-k/latest/languages/xml.html) -Build this project: +The opinionated default language for ICamel is JavaScript. To use other languages than JavaScript or XML, prepend a comment line `// language=...` at the beginning of each cell. - mvn clean install +- Groovy + + ```groovy + // language=groovy + from('timer:tick') + .process { it.in.body = 'Hello Camel K!' } + .to('log:info') + ``` + +- Kotlin + + ```kotlin + // language=kts + from("timer:tick") + .process { e -> e.getIn().body = "Hello Camel K!" } + .to("log:info") + ``` + +- java + + ```java + // language=java + import org.apache.camel.builder.RouteBuilder; + + public class Sample extends RouteBuilder { + @Override + public void configure() throws Exception { + from("timer:tick") + .setBody() + .constant("Hello Camel K!") + .to("log:info"); + } + } + ``` + +## Installing + +Download the latest `icamel-0.x.jar` from https://github.com/tadayosi/icamel/packages. Then create a directory `camel` under the Jupyter kernels directory: mkdir `jupyter --data-dir`/kernels/camel -and copy `target/icamel-0.1-SNAPSHOT.jar` into the directory: +and copy `target/icamel-0.x.jar` into the directory: - cp target/icamel-0.1-SNAPSHOT.jar `jupyter --data-dir`/kernels/camel/ + cp target/icamel-0.x.jar `jupyter --data-dir`/kernels/camel/ Finally, create a file `kernel.json` with the following content under the `camel` kernel directory. Note `` needs to be substituted with the actual path (e.g. `/home/username/.local/share/jupyter/kernels/camel`): @@ -32,7 +73,7 @@ Finally, create a file `kernel.json` with the following content under the `camel "argv": [ "java", "-jar", - "/icamel-0.1-SNAPSHOT.jar", + "/icamel-0.x.jar", "{connection_file}" ], "display_name": "Camel", @@ -42,3 +83,9 @@ Finally, create a file `kernel.json` with the following content under the `camel } } ``` + +## Build from source + +Run the following command: + + mvn clean install diff --git a/kernel.json b/kernel.json index cf6a99c..4728cc4 100644 --- a/kernel.json +++ b/kernel.json @@ -2,7 +2,7 @@ "argv": [ "java", "-jar", - "${user.home}/.local/share/jupyter/kernels/camel/icamel-${project.version}.jar", + "/icamel-0.x.jar", "{connection_file}" ], "display_name": "Camel",