Skip to content

Commit

Permalink
doc: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tadayosi committed Apr 28, 2020
1 parent 09cd89c commit 82067e6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
63 changes: 55 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<your-camel-kernel-dir>` needs to be substituted with the actual path (e.g. `/home/username/.local/share/jupyter/kernels/camel`):

Expand All @@ -32,7 +73,7 @@ Finally, create a file `kernel.json` with the following content under the `camel
"argv": [
"java",
"-jar",
"<your-camel-kernel-dir>/icamel-0.1-SNAPSHOT.jar",
"<your-camel-kernel-dir>/icamel-0.x.jar",
"{connection_file}"
],
"display_name": "Camel",
Expand All @@ -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
2 changes: 1 addition & 1 deletion kernel.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"argv": [
"java",
"-jar",
"${user.home}/.local/share/jupyter/kernels/camel/icamel-${project.version}.jar",
"<your-camel-kernel-dir>/icamel-0.x.jar",
"{connection_file}"
],
"display_name": "Camel",
Expand Down

0 comments on commit 82067e6

Please sign in to comment.