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 2020/11/26 08:45:58 UTC
[camel] 03/03: CAMEL-15704: camel-csimple - Compiled simple
language.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f2b5858114de67ce0c526748979c33c26064c3c1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 26 09:45:24 2020 +0100
CAMEL-15704: camel-csimple - Compiled simple language.
---
.../camel/catalog/docs/csimple-language.adoc | 123 ++++++++++++++++++---
.../apache/camel/catalog/docs/simple-language.adoc | 5 +
.../modules/languages/pages/csimple-language.adoc | 123 ++++++++++++++++++---
.../modules/languages/pages/simple-language.adoc | 5 +
.../csimple/CSimplePredicateParserTest.java | 47 ++++----
.../modules/languages/pages/csimple-language.adoc | 123 ++++++++++++++++++---
.../modules/languages/pages/simple-language.adoc | 5 +
7 files changed, 367 insertions(+), 64 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/csimple-language.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/csimple-language.adoc
index 25f62f0..ae1f337 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/csimple-language.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/csimple-language.adoc
@@ -11,22 +11,122 @@ include::{cq-version}@camel-quarkus:ROOT:partial$reference/languages/csimple.ado
The CSimple language is *compiled* xref:simple-language.adoc[Simple] language.
-
== Different between CSimple and Simple
-The simple language is a dynamic expression language which is runtime parsed into a set of Camel `Expression`'s or `Predicate`'s.
+The simple language is a dynamic expression language which is runtime parsed into a set of Camel Expressions or Predicates.
-The csimple language is parsed into regular Java source code and compiled together with all the other source code, or it
-can be compiled once during bootstrap via the `camel-csimple-joor` module.
+The csimple language is parsed into regular Java source code and compiled together with all the other source code,
+or compiled once during bootstrap via the `camel-csimple-joor` module.
The simple langauge is generally very lightweight and fast, however for some use-cases with dynamic method calls via OGNL paths,
-then the simple language does runtime introspection and reflection calls. This has an overhead on performance, and one of the reasons
-why csimple was created. However csimple requires to be typesafe and method calls via OGNL paths requires to know the type during parsing.
-This means for csimple languages expressions you would need to provide the class type where as simple could introspect this at runtime.
+then the simple language does runtime introspection and reflection calls. This has an overhead on performance,
+and was one of the reasons why csimple was created.
-In other words the simple language is using _duck typing_ (if it looks like a duck, and quacks like a duck, then it is a duck)
-and csimple is using Java type (typesafety). If there is a type error then simple will report this at runtime, and csimple you will see a Java compiler error.
+Csimple requires to be typesafe and method calls via OGNL paths requires to know the type during parsing.
+This means for csimple languages expressions you would need to provide the class type in the script,
+where as simple introspects this at runtime.
+In other words the simple language is using _duck typing_ (if it looks like a duck, and quacks like a duck, then it is a duck)
+and csimple is using Java type (typesafety). If there is a type error then simple will report this at runtime,
+and with csimple there will be a Java compilation error.
+
+== Compilation
+
+The csimple language is parsed into regular Java source code and compiled together with all the other source code, or it can be compiled once during bootstrap via the `camel-csimple-joor` module.
+
+There are two ways to compile csimple
+
+- using the `camel-csimple-maven-plugin` generating source code at built time.
+- using `camel-csimple-joor` which does runtime in-memory compilation during bootstrap of Camel.
+
+=== Using camel-csimple-maven-plugin
+
+You should either use the `camel-csimple-maven-plugin` to use the Maven plugin to discover all the csimple scripts from the source code, and then automatic generate source code in the `src/generated/java` folder, which then gets compiled together with all the other sources.
+
+The maven plugin will do source code scanning of `.java` and `.xml` files (Java and XML DSL).
+The scanner is limited to detect certain code patterns, and it may miss discovering some csimple scripts if they are being used in unusual/rare ways.
+
+The runtime compilation using `camel-csimple-joor` does not have this limitation.
+
+However the pros is that all of the csimple scripts will be compiled using the regular Java compiler and therefore everything is included out of the box as `.class` files in the application JAR file.
+And no additional dependencies is needed at runtime.
+
+See the `camel-example-csimple` example at https://github.com/apache/camel-examples[Camel Examples] which uses the maven plugin.
+
+To use `camel-csimple-maven-plugin` you need to add it to your `pom.xml` file as shown:
+
+[source,xml]
+----
+<plugins>
+ <!-- generate source code for csimple languages -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-csimple-maven-plugin</artifactId>
+ <version>${camel.version}</version>
+ <executions>
+ <execution>
+ <id>generate</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- include source code generated to maven sources paths -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>add-resource</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/generated/java</source>
+ </sources>
+ <resources>
+ <resource>
+ <directory>src/generated/resources</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+</plugins>
+----
+
+And then you must also add the `build-helper-maven-plugin` Maven plugin to include `src/generated` to the list of source folders for the Java compiler,
+to ensure the generated source code is compiled and included in the application JAR file.
+
+=== Using camel-csimple-joor
+
+The jOOR library integrates with the Java compiler and performs runtime compilation of Java code.
+
+The supported runtime when using `camel-simple-joor` is intended for Java standalone, Spring Boot, Camel Quarkus and other microservices runtimes.
+It is not supported in OSGi, Camel Karaf or any kind of Java Application Server runtime.
+
+jOOR does not support runtime compilation with Spring Boot using _fat jar_ packaging (https://github.com/jOOQ/jOOR/issues/69),
+it works with exploded classpath.
+
+To use `camel-simple-joor` you simply just add it as dependency to the classpath:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-csimple-joor</artifactId>
+ <version>x.x.x</version>
+</dependency>
+----
+
+There is no need for adding Maven plugins to the `pom.xml` file.
+
+See the `camel-example-csimple-joor` example at https://github.com/apache/camel-examples[Camel Examples] which uses the jOOR compiler.
== CSimple Language options
@@ -46,8 +146,3 @@ The CSimple language supports 2 options, which are listed below.
== More documentation
See the xref:simple-language.adoc[Simple] language as csimple has the same set of functions as simple language.
-
-== Example
-
-See `camel-example-csimple` and `camel-example-csimple-joor` examples at https://github.com/apache/camel-examples[Camel Examples]
-
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-language.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-language.adoc
index 97c077a..6e98a0b 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-language.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-language.adoc
@@ -28,6 +28,11 @@ choose a more expressive and powerful language such as:
The simple language uses `${body`} placeholders for complex expressions or functions.
+[NOTE]
+====
+See also the xref:csimple-language.adoc[CSimple] language which is *compiled*.
+====
+
[TIP]
====
*Alternative syntax*
diff --git a/core/camel-core-languages/src/main/docs/modules/languages/pages/csimple-language.adoc b/core/camel-core-languages/src/main/docs/modules/languages/pages/csimple-language.adoc
index 25f62f0..ae1f337 100644
--- a/core/camel-core-languages/src/main/docs/modules/languages/pages/csimple-language.adoc
+++ b/core/camel-core-languages/src/main/docs/modules/languages/pages/csimple-language.adoc
@@ -11,22 +11,122 @@ include::{cq-version}@camel-quarkus:ROOT:partial$reference/languages/csimple.ado
The CSimple language is *compiled* xref:simple-language.adoc[Simple] language.
-
== Different between CSimple and Simple
-The simple language is a dynamic expression language which is runtime parsed into a set of Camel `Expression`'s or `Predicate`'s.
+The simple language is a dynamic expression language which is runtime parsed into a set of Camel Expressions or Predicates.
-The csimple language is parsed into regular Java source code and compiled together with all the other source code, or it
-can be compiled once during bootstrap via the `camel-csimple-joor` module.
+The csimple language is parsed into regular Java source code and compiled together with all the other source code,
+or compiled once during bootstrap via the `camel-csimple-joor` module.
The simple langauge is generally very lightweight and fast, however for some use-cases with dynamic method calls via OGNL paths,
-then the simple language does runtime introspection and reflection calls. This has an overhead on performance, and one of the reasons
-why csimple was created. However csimple requires to be typesafe and method calls via OGNL paths requires to know the type during parsing.
-This means for csimple languages expressions you would need to provide the class type where as simple could introspect this at runtime.
+then the simple language does runtime introspection and reflection calls. This has an overhead on performance,
+and was one of the reasons why csimple was created.
-In other words the simple language is using _duck typing_ (if it looks like a duck, and quacks like a duck, then it is a duck)
-and csimple is using Java type (typesafety). If there is a type error then simple will report this at runtime, and csimple you will see a Java compiler error.
+Csimple requires to be typesafe and method calls via OGNL paths requires to know the type during parsing.
+This means for csimple languages expressions you would need to provide the class type in the script,
+where as simple introspects this at runtime.
+In other words the simple language is using _duck typing_ (if it looks like a duck, and quacks like a duck, then it is a duck)
+and csimple is using Java type (typesafety). If there is a type error then simple will report this at runtime,
+and with csimple there will be a Java compilation error.
+
+== Compilation
+
+The csimple language is parsed into regular Java source code and compiled together with all the other source code, or it can be compiled once during bootstrap via the `camel-csimple-joor` module.
+
+There are two ways to compile csimple
+
+- using the `camel-csimple-maven-plugin` generating source code at built time.
+- using `camel-csimple-joor` which does runtime in-memory compilation during bootstrap of Camel.
+
+=== Using camel-csimple-maven-plugin
+
+You should either use the `camel-csimple-maven-plugin` to use the Maven plugin to discover all the csimple scripts from the source code, and then automatic generate source code in the `src/generated/java` folder, which then gets compiled together with all the other sources.
+
+The maven plugin will do source code scanning of `.java` and `.xml` files (Java and XML DSL).
+The scanner is limited to detect certain code patterns, and it may miss discovering some csimple scripts if they are being used in unusual/rare ways.
+
+The runtime compilation using `camel-csimple-joor` does not have this limitation.
+
+However the pros is that all of the csimple scripts will be compiled using the regular Java compiler and therefore everything is included out of the box as `.class` files in the application JAR file.
+And no additional dependencies is needed at runtime.
+
+See the `camel-example-csimple` example at https://github.com/apache/camel-examples[Camel Examples] which uses the maven plugin.
+
+To use `camel-csimple-maven-plugin` you need to add it to your `pom.xml` file as shown:
+
+[source,xml]
+----
+<plugins>
+ <!-- generate source code for csimple languages -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-csimple-maven-plugin</artifactId>
+ <version>${camel.version}</version>
+ <executions>
+ <execution>
+ <id>generate</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- include source code generated to maven sources paths -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>add-resource</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/generated/java</source>
+ </sources>
+ <resources>
+ <resource>
+ <directory>src/generated/resources</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+</plugins>
+----
+
+And then you must also add the `build-helper-maven-plugin` Maven plugin to include `src/generated` to the list of source folders for the Java compiler,
+to ensure the generated source code is compiled and included in the application JAR file.
+
+=== Using camel-csimple-joor
+
+The jOOR library integrates with the Java compiler and performs runtime compilation of Java code.
+
+The supported runtime when using `camel-simple-joor` is intended for Java standalone, Spring Boot, Camel Quarkus and other microservices runtimes.
+It is not supported in OSGi, Camel Karaf or any kind of Java Application Server runtime.
+
+jOOR does not support runtime compilation with Spring Boot using _fat jar_ packaging (https://github.com/jOOQ/jOOR/issues/69),
+it works with exploded classpath.
+
+To use `camel-simple-joor` you simply just add it as dependency to the classpath:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-csimple-joor</artifactId>
+ <version>x.x.x</version>
+</dependency>
+----
+
+There is no need for adding Maven plugins to the `pom.xml` file.
+
+See the `camel-example-csimple-joor` example at https://github.com/apache/camel-examples[Camel Examples] which uses the jOOR compiler.
== CSimple Language options
@@ -46,8 +146,3 @@ The CSimple language supports 2 options, which are listed below.
== More documentation
See the xref:simple-language.adoc[Simple] language as csimple has the same set of functions as simple language.
-
-== Example
-
-See `camel-example-csimple` and `camel-example-csimple-joor` examples at https://github.com/apache/camel-examples[Camel Examples]
-
diff --git a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
index 97c077a..6e98a0b 100644
--- a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
+++ b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-language.adoc
@@ -28,6 +28,11 @@ choose a more expressive and powerful language such as:
The simple language uses `${body`} placeholders for complex expressions or functions.
+[NOTE]
+====
+See also the xref:csimple-language.adoc[CSimple] language which is *compiled*.
+====
+
[TIP]
====
*Alternative syntax*
diff --git a/core/camel-core/src/test/java/org/apache/camel/language/csimple/CSimplePredicateParserTest.java b/core/camel-core/src/test/java/org/apache/camel/language/csimple/CSimplePredicateParserTest.java
index 47fd3c3..940986f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/language/csimple/CSimplePredicateParserTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/language/csimple/CSimplePredicateParserTest.java
@@ -26,43 +26,44 @@ public class CSimplePredicateParserTest {
CSimplePredicateParser parser = new CSimplePredicateParser();
String code = parser.parsePredicate("'bar' != 'foo'");
- Assertions.assertEquals("'bar' != 'foo'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, 'bar', 'foo')", code);
code = parser.parsePredicate("${body} == 'foo'");
- Assertions.assertEquals("body == 'foo'", code);
+ Assertions.assertEquals("isEqualTo(exchange, body, 'foo')", code);
code = parser.parsePredicate("${body} != 'foo'");
- Assertions.assertEquals("body != 'foo'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, body, 'foo')", code);
code = parser.parsePredicate("${body} == 123");
- Assertions.assertEquals("body == 123", code); // integer value
+ Assertions.assertEquals("isEqualTo(exchange, body, 123)", code);
code = parser.parsePredicate("${body} > 9.95");
- Assertions.assertEquals("body > 9.95d", code); // double value
+ Assertions.assertEquals("isGreaterThan(exchange, body, 9.95d)", code); // double value
code = parser.parsePredicate("${body} > 123456789012345");
- Assertions.assertEquals("body > 123456789012345l", code); // long value
+ Assertions.assertEquals("isGreaterThan(exchange, body, 123456789012345l)", code); // long value
code = parser.parsePredicate("${bodyAs(int)} == 123");
- Assertions.assertEquals("bodyAs(message, int.class) == 123", code);
+ Assertions.assertEquals("isEqualTo(exchange, bodyAs(message, int.class), 123)", code);
code = parser.parsePredicate("${bodyAs(String).length()} == 4");
- Assertions.assertEquals("bodyAs(message, String.class).length() == 4", code);
+ Assertions.assertEquals("isEqualTo(exchange, bodyAs(message, String.class).length(), 4)", code);
code = parser.parsePredicate("${bodyAs(String).substring(3)} == 'DEF'");
- Assertions.assertEquals("bodyAs(message, String.class).substring(3) == 'DEF'", code);
+ Assertions.assertEquals("isEqualTo(exchange, bodyAs(message, String.class).substring(3), 'DEF')", code);
code = parser.parsePredicate("${bodyAs(int)} > ${headerAs('foo', int)}");
- Assertions.assertEquals("bodyAs(message, int.class) > headerAs(message, 'foo', int.class)", code);
+ Assertions.assertEquals("isGreaterThan(exchange, bodyAs(message, int.class), headerAs(message, 'foo', int.class))",
+ code);
code = parser.parsePredicate("${camelContext.getName()} == 'myCamel'");
- Assertions.assertEquals("camelContext.getName() == 'myCamel'", code);
+ Assertions.assertEquals("isEqualTo(exchange, camelContext.getName(), 'myCamel')", code);
code = parser.parsePredicate("${camelContext.name} == 'myCamel'");
- Assertions.assertEquals("camelContext.getName() == 'myCamel'", code);
+ Assertions.assertEquals("isEqualTo(exchange, camelContext.getName(), 'myCamel')", code);
code = parser.parsePredicate("${camelContext.inflightRepository.size()} > 0");
- Assertions.assertEquals("camelContext.getInflightRepository().size() > 0", code);
+ Assertions.assertEquals("isGreaterThan(exchange, camelContext.getInflightRepository().size(), 0)", code);
}
@Test
@@ -70,33 +71,35 @@ public class CSimplePredicateParserTest {
CSimplePredicateParser parser = new CSimplePredicateParser();
String code = parser.parsePredicate("${body.substring(1, ${header.max})} == 'foo'");
- Assertions.assertEquals("body.substring(1, header(message, 'max')) == 'foo'", code);
+ Assertions.assertEquals("isEqualTo(exchange, body.substring(1, header(message, 'max')), 'foo')", code);
}
@Test
public void testParseSysFunctions() throws Exception {
CSimplePredicateParser parser = new CSimplePredicateParser();
String code = parser.parsePredicate("${sys.foo} != 'bar'");
- Assertions.assertEquals("sys('foo') != 'bar'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, sys('foo'), 'bar')", code);
code = parser.parsePredicate("${env.foo} != 'bar'");
- Assertions.assertEquals("sysenv('foo') != 'bar'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, sysenv('foo'), 'bar')", code);
code = parser.parsePredicate("${env:FOO} != 'bar'");
- Assertions.assertEquals("sysenv('FOO') != 'bar'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, sysenv('FOO'), 'bar')", code);
}
@Test
public void testParseExchangeProperty() throws Exception {
CSimplePredicateParser parser = new CSimplePredicateParser();
String code = parser.parsePredicate("${exchangeProperty.foo} != 'bar'");
- Assertions.assertEquals("exchangeProperty(exchange, 'foo') != 'bar'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, exchangeProperty(exchange, 'foo'), 'bar')", code);
code = parser.parsePredicate("${exchangeProperty[foo]} != 'bar'");
- Assertions.assertEquals("exchangeProperty(exchange, 'foo') != 'bar'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, exchangeProperty(exchange, 'foo'), 'bar')", code);
code = parser.parsePredicate("${exchangePropertyAs(foo, com.foo.User)} != 'bar'");
- Assertions.assertEquals("exchangePropertyAs(exchange, 'foo', com.foo.User.class) != 'bar'", code);
+ Assertions.assertEquals("isNotEqualTo(exchange, exchangePropertyAs(exchange, 'foo', com.foo.User.class), 'bar')", code);
code = parser.parsePredicate("${exchangePropertyAs(foo, com.foo.User).name} != 'bar'");
- Assertions.assertEquals("exchangePropertyAs(exchange, 'foo', com.foo.User.class).getName() != 'bar'", code);
+ Assertions.assertEquals(
+ "isNotEqualTo(exchange, exchangePropertyAs(exchange, 'foo', com.foo.User.class).getName(), 'bar')", code);
code = parser.parsePredicate("${exchangePropertyAs(foo, com.foo.User).getName()} != 'bar'");
- Assertions.assertEquals("exchangePropertyAs(exchange, 'foo', com.foo.User.class).getName() != 'bar'", code);
+ Assertions.assertEquals(
+ "isNotEqualTo(exchange, exchangePropertyAs(exchange, 'foo', com.foo.User.class).getName(), 'bar')", code);
}
}
diff --git a/docs/components/modules/languages/pages/csimple-language.adoc b/docs/components/modules/languages/pages/csimple-language.adoc
index 1f023bd..f9b3370 100644
--- a/docs/components/modules/languages/pages/csimple-language.adoc
+++ b/docs/components/modules/languages/pages/csimple-language.adoc
@@ -13,22 +13,122 @@ include::{cq-version}@camel-quarkus:ROOT:partial$reference/languages/csimple.ado
The CSimple language is *compiled* xref:simple-language.adoc[Simple] language.
-
== Different between CSimple and Simple
-The simple language is a dynamic expression language which is runtime parsed into a set of Camel `Expression`'s or `Predicate`'s.
+The simple language is a dynamic expression language which is runtime parsed into a set of Camel Expressions or Predicates.
-The csimple language is parsed into regular Java source code and compiled together with all the other source code, or it
-can be compiled once during bootstrap via the `camel-csimple-joor` module.
+The csimple language is parsed into regular Java source code and compiled together with all the other source code,
+or compiled once during bootstrap via the `camel-csimple-joor` module.
The simple langauge is generally very lightweight and fast, however for some use-cases with dynamic method calls via OGNL paths,
-then the simple language does runtime introspection and reflection calls. This has an overhead on performance, and one of the reasons
-why csimple was created. However csimple requires to be typesafe and method calls via OGNL paths requires to know the type during parsing.
-This means for csimple languages expressions you would need to provide the class type where as simple could introspect this at runtime.
+then the simple language does runtime introspection and reflection calls. This has an overhead on performance,
+and was one of the reasons why csimple was created.
-In other words the simple language is using _duck typing_ (if it looks like a duck, and quacks like a duck, then it is a duck)
-and csimple is using Java type (typesafety). If there is a type error then simple will report this at runtime, and csimple you will see a Java compiler error.
+Csimple requires to be typesafe and method calls via OGNL paths requires to know the type during parsing.
+This means for csimple languages expressions you would need to provide the class type in the script,
+where as simple introspects this at runtime.
+In other words the simple language is using _duck typing_ (if it looks like a duck, and quacks like a duck, then it is a duck)
+and csimple is using Java type (typesafety). If there is a type error then simple will report this at runtime,
+and with csimple there will be a Java compilation error.
+
+== Compilation
+
+The csimple language is parsed into regular Java source code and compiled together with all the other source code, or it can be compiled once during bootstrap via the `camel-csimple-joor` module.
+
+There are two ways to compile csimple
+
+- using the `camel-csimple-maven-plugin` generating source code at built time.
+- using `camel-csimple-joor` which does runtime in-memory compilation during bootstrap of Camel.
+
+=== Using camel-csimple-maven-plugin
+
+You should either use the `camel-csimple-maven-plugin` to use the Maven plugin to discover all the csimple scripts from the source code, and then automatic generate source code in the `src/generated/java` folder, which then gets compiled together with all the other sources.
+
+The maven plugin will do source code scanning of `.java` and `.xml` files (Java and XML DSL).
+The scanner is limited to detect certain code patterns, and it may miss discovering some csimple scripts if they are being used in unusual/rare ways.
+
+The runtime compilation using `camel-csimple-joor` does not have this limitation.
+
+However the pros is that all of the csimple scripts will be compiled using the regular Java compiler and therefore everything is included out of the box as `.class` files in the application JAR file.
+And no additional dependencies is needed at runtime.
+
+See the `camel-example-csimple` example at https://github.com/apache/camel-examples[Camel Examples] which uses the maven plugin.
+
+To use `camel-csimple-maven-plugin` you need to add it to your `pom.xml` file as shown:
+
+[source,xml]
+----
+<plugins>
+ <!-- generate source code for csimple languages -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-csimple-maven-plugin</artifactId>
+ <version>${camel.version}</version>
+ <executions>
+ <execution>
+ <id>generate</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- include source code generated to maven sources paths -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ <goal>add-resource</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/generated/java</source>
+ </sources>
+ <resources>
+ <resource>
+ <directory>src/generated/resources</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+</plugins>
+----
+
+And then you must also add the `build-helper-maven-plugin` Maven plugin to include `src/generated` to the list of source folders for the Java compiler,
+to ensure the generated source code is compiled and included in the application JAR file.
+
+=== Using camel-csimple-joor
+
+The jOOR library integrates with the Java compiler and performs runtime compilation of Java code.
+
+The supported runtime when using `camel-simple-joor` is intended for Java standalone, Spring Boot, Camel Quarkus and other microservices runtimes.
+It is not supported in OSGi, Camel Karaf or any kind of Java Application Server runtime.
+
+jOOR does not support runtime compilation with Spring Boot using _fat jar_ packaging (https://github.com/jOOQ/jOOR/issues/69),
+it works with exploded classpath.
+
+To use `camel-simple-joor` you simply just add it as dependency to the classpath:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-csimple-joor</artifactId>
+ <version>x.x.x</version>
+</dependency>
+----
+
+There is no need for adding Maven plugins to the `pom.xml` file.
+
+See the `camel-example-csimple-joor` example at https://github.com/apache/camel-examples[Camel Examples] which uses the jOOR compiler.
== CSimple Language options
@@ -48,8 +148,3 @@ The CSimple language supports 2 options, which are listed below.
== More documentation
See the xref:simple-language.adoc[Simple] language as csimple has the same set of functions as simple language.
-
-== Example
-
-See `camel-example-csimple` and `camel-example-csimple-joor` examples at https://github.com/apache/camel-examples[Camel Examples]
-
diff --git a/docs/components/modules/languages/pages/simple-language.adoc b/docs/components/modules/languages/pages/simple-language.adoc
index cb092a65..14e8c42 100644
--- a/docs/components/modules/languages/pages/simple-language.adoc
+++ b/docs/components/modules/languages/pages/simple-language.adoc
@@ -30,6 +30,11 @@ choose a more expressive and powerful language such as:
The simple language uses `${body`} placeholders for complex expressions or functions.
+[NOTE]
+====
+See also the xref:csimple-language.adoc[CSimple] language which is *compiled*.
+====
+
[TIP]
====
*Alternative syntax*