| = Java DSL (runtime compiled) Component |
| :doctitle: Java DSL (runtime compiled) |
| :shortname: java-joor-dsl |
| :artifactid: camel-java-joor-dsl |
| :description: Camel Java DSL with jOOR |
| :since: 3.9 |
| :supportlevel: Stable |
| //Manually maintained attributes |
| :group: DSL |
| |
| *Since Camel {since}* |
| |
| The `java-joor-dsl` is used for runtime compiling Java routes in an existing running Camel integration. |
| This was invented for Camel K and later ported to Apache Camel. |
| |
| This means that Camel will load the `.java` source during startup and compile this to Java byte code as `.class`, |
| which then are loaded via class loader and behaves as regular Java compiled routes. |
| |
| == Example |
| |
| The following `MyRoute.java` source file: |
| |
| .MyRoute.java |
| [source,java] |
| ---- |
| import org.apache.camel.builder.RouteBuilder; |
| |
| public class MyRoute extends RouteBuilder { |
| |
| @Override |
| public void configure() throws Exception { |
| from("timer:tick") |
| .setBody() |
| .constant("Hello Camel K!") |
| .to("log:info"); |
| } |
| } |
| ---- |
| |
| Can then be loaded and run with Camel CLI or Camel K. |
| |
| .Running with Camel K |
| |
| [source,bash] |
| ---- |
| kamel run MyRoute.java |
| ---- |
| |
| .Running with Camel CLI |
| |
| [source,bash] |
| ---- |
| camel run MyRoute.java |
| ---- |
| |
| |
| == See Also |
| |
| See xref:manual:ROOT:dsl.adoc[DSL] |