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.git
commit 96275e0c04600e309a49e949784f9864a1a7fa21 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Feb 20 21:10:03 2026 +0100 CAMEL-16861: Update docs --- .../modules/ROOT/pages/lambda-route-builder.adoc | 9 ++++++-- .../modules/ROOT/pages/language-dsl.adoc | 26 ++++++++++++++++++---- docs/user-manual/modules/ROOT/pages/languages.adoc | 11 +++++---- docs/user-manual/modules/ROOT/pages/lifecycle.adoc | 9 ++++++-- 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/lambda-route-builder.adoc b/docs/user-manual/modules/ROOT/pages/lambda-route-builder.adoc index 8a8b2caf8dc6..f8d854673912 100644 --- a/docs/user-manual/modules/ROOT/pages/lambda-route-builder.adoc +++ b/docs/user-manual/modules/ROOT/pages/lambda-route-builder.adoc @@ -26,7 +26,8 @@ The method should be annotated with `@BindToRegistry` in standalone mode with `c public class MyConfiguration { @BindToRegistry public LambdaRouteBuilder myRoute() { - return rb -> rb.from("kafka:cheese").to("jms:queue:foo"); + return rb -> rb.from("kafka:cheese?clientId=myClient&batching=true") + .to("jms:queue:foo"); } } ---- @@ -41,7 +42,8 @@ The xref:Endpoint-dsl.adoc[Endpoint DSL] can also be used as a lambda route buil public class MyConfiguration { @BindToRegistry public LambdaEndpointRouteBuilder myRoute() { - return rb -> rb.from(rb.kafka("cheese")).to(rb.jms("queue:foo")); + return rb -> rb.from(rb.kafka("cheese").clientId("myClient").batching(true)) + .to(rb.jms("queue:foo")); } } ---- @@ -60,3 +62,6 @@ With the regular `LambdaRouteBuilder` it's just a `String` type, so the `rb` pre ---- rb.from("kafka:cheese") ---- + +On the other hand then the _type safe_ endpoint DSL allows your Java IDE to show available options which can be configured. +In this example we have configured the clientId and batching options. This is of great help, as the Kafka component has 100+ options. diff --git a/docs/user-manual/modules/ROOT/pages/language-dsl.adoc b/docs/user-manual/modules/ROOT/pages/language-dsl.adoc index 066196ed8e63..9daa21fb3faf 100644 --- a/docs/user-manual/modules/ROOT/pages/language-dsl.adoc +++ b/docs/user-manual/modules/ROOT/pages/language-dsl.adoc @@ -5,7 +5,7 @@ Camel xref:languages.adoc[Languages]. The Language DSL is exclusively available as part of the Java DSL. -The DSL can be accessed directly from the `RouteBuilder` thanks to the method `expression()`. +The DSL can be accessed directly from the `RouteBuilder` with the `expression()` method. == Using Language DSL @@ -57,9 +57,8 @@ public class MyRoutes extends RouteBuilder { .tokenize() // <2> .token("(\\W+)\\s*") // <3> .regex(true) // <3> - .end() // <4> - ) - .process("processEntry"); + .end()) // <4> + .process("processEntry"); } } ---- @@ -67,3 +66,22 @@ public class MyRoutes extends RouteBuilder { <2> Select the `tokenize` language <3> Configure the expression according to the needs <4> Build the expression with the expected configuration + +Sometimes creating an expression can be a bit verbose with a number of fluent builder methods. +What you can do is to pre create the expression before the route as shown below: + +[source,java] +---- +public class MyRoutes extends RouteBuilder { + @Override + public void configure() { + var token = expression().tokenize().token("(\\W+)\\s*").regex(true).end(); // <1> + + from("file:data") + .split(token) // <2> + .process("processEntry"); + } +} +---- +<1> Pre create the expression +<2> Use the expression in the route diff --git a/docs/user-manual/modules/ROOT/pages/languages.adoc b/docs/user-manual/modules/ROOT/pages/languages.adoc index b5bb2a3cb631..fead6e7ce76a 100644 --- a/docs/user-manual/modules/ROOT/pages/languages.adoc +++ b/docs/user-manual/modules/ROOT/pages/languages.adoc @@ -1,16 +1,15 @@ = Languages -To support flexible and powerful -xref:components:eips:enterprise-integration-patterns.adoc[Enterprise Integration -Patterns], Camel supports various Languages to create an -xref:expression.adoc[Expression] or xref:predicate.adoc[Predicate] +To support flexible and powerful xref:components:eips:enterprise-integration-patterns.adoc[Enterprise Integration Patterns], +Camel supports various Languages to create an xref:expression.adoc[Expression] or xref:predicate.adoc[Predicate] within the xref:routes.adoc[Routes] and xref:dsl.adoc[DSL].. == Supported languages -There are about 20 different xref:components:languages:index.adoc[Languages] such +There are more than 25 different xref:components:languages:index.adoc[Languages] such as scripted programming languages like Groovy, and template based languages like Velocity and Freemarker, -and XML/JSon languages, and many others. +and XML/JSon languages, and industry specifics such as Finance and Health Care, and many others. Most of these languages are also supported used as xref:parameter-binding-annotations.adoc[Annotation Based Expression Language] in Java beans. + diff --git a/docs/user-manual/modules/ROOT/pages/lifecycle.adoc b/docs/user-manual/modules/ROOT/pages/lifecycle.adoc index aa238f932940..6b9d53cc3351 100644 --- a/docs/user-manual/modules/ROOT/pages/lifecycle.adoc +++ b/docs/user-manual/modules/ROOT/pages/lifecycle.adoc @@ -22,6 +22,7 @@ The `CamelContext` provides methods to control its lifecycle: * `stop` * `suspend` * `resume` +* `shutdown` The operations are paired: start/stop and suspend/resume. @@ -30,11 +31,15 @@ which means all its internal state, cache, etc is cleared; and the routes is being stopped in a graceful manner to ensure messages are given time to complete. +Shutdown is the last phase when Camel is shutting down. After shutdown then Camel cannot be started again. +The shutdown happens automatic when a JVM is terminating, such as Spring Boot applications that has been signalled to terminate. + IMPORTANT: If you start a `CamelContext` after a stop, then its performing a _cold_ start, recreating all the state, cache etc. again; which is not guaranteed to startup correctly again. -Instead you can use the suspend/resume operations. They will keep the +Instead, you can use the suspend/resume operations. They will keep the `CamelContext` _warm_ and only suspend/stop routes using the same -graceful shutdown feature. This ensures messages are given time to complete. +xref:graceful-shutdown.adoc[Graceful Shutdown] feature. +This ensures messages are given time to complete. End users is encouraged to use suspend/resume if you are temporary stopping a Camel application.
