This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2ffb1e96c5cf69e2efecbd43270c08dc7cd5b888 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Fri Jan 6 12:15:51 2023 +0100 (chores) documentation: more cleanup in the documentation about routes --- docs/main/modules/getting-started/pages/index.adoc | 2 ++ .../working-with-camel-core/pages/index.adoc | 5 ++-- docs/user-manual/modules/ROOT/pages/component.adoc | 1 - docs/user-manual/modules/ROOT/pages/java-dsl.adoc | 19 ++++++++++-- docs/user-manual/modules/ROOT/pages/routes.adoc | 34 +++++++--------------- docs/user-manual/modules/ROOT/pages/uris.adoc | 20 +++++-------- 6 files changed, 40 insertions(+), 41 deletions(-) diff --git a/docs/main/modules/getting-started/pages/index.adoc b/docs/main/modules/getting-started/pages/index.adoc index 6557c72bf1d..2fbfc92d2d9 100644 --- a/docs/main/modules/getting-started/pages/index.adoc +++ b/docs/main/modules/getting-started/pages/index.adoc @@ -234,6 +234,8 @@ In Camel, Uniform Resource Identifiers (URIs) represent the addresses of the end * A _resource identifier_. * The options for the component. +Camel makes extensive use of xref:manual::uris.adoc[URIs] to allow you to refer to xref:manual::endpoint.adoc[Endpoints]. + [[BookGettingStarted-TheMeaningofURL-URI-URN]] ===== The Meaning of URL, URI and URN diff --git a/docs/main/modules/working-with-camel-core/pages/index.adoc b/docs/main/modules/working-with-camel-core/pages/index.adoc index 71101cb8309..d46ad7a50d1 100644 --- a/docs/main/modules/working-with-camel-core/pages/index.adoc +++ b/docs/main/modules/working-with-camel-core/pages/index.adoc @@ -11,16 +11,16 @@ We have prepared these two guides to explain in greater detail a few of the conc In Apache Camel, a _route_ is a set of processing steps that are applied to a message as it travels from a source to a destination. A route typically consists of a series of processing steps that are connected in a linear sequence. -In other words, a Camel _route_ is where the integration flow is defined. For example, you can write a Camel route to specify how two systems can be integrated. The following 2 guides provide the fundamental knowledge of Camel routes: +In other words, a Camel _route_ is where the integration flow is defined. For example, you can write a Camel route to specify how two systems can be integrated. The following guide provides the fundamental knowledge of Camel routes: * xref:manual::routes.adoc[Routes]: the basic guide about Camel Routes. -* xref:manual::route-builder.adoc[Route Builder]: describes the base class from which you can create Routes. If you have basic knowledge about _routes_, you can use the following guides to learn how to write them in different languages, handle errors, and customize them. * Routes (Basic + DSL) ** xref:manual::java-dsl.adoc[Java DSL]: the default language to write _routes_. ** xref:manual::dsl.adoc[DSL overview]: writing routes in other languages (XML, YAML, etc). +** xref:manual::uris.adoc[URIs] * Routes (Writing) ** xref:manual::expression.adoc[Expression] @@ -92,7 +92,6 @@ Learn about additional ways to customize your integrations. Explore alternatives ** xref:manual::service-registry.adoc[Service Registry] ** xref:manual::spring.adoc[Spring] ** xref:manual::spring-xml-extensions.adoc[Spring XML Extensions] -** xref:manual::uris.adoc[URIs] ** xref:manual::validator.adoc[Validator] ** xref:manual::what-are-the-dependencies.adoc[Camel Requirements] ** xref:manual::testing.adoc[Testing] diff --git a/docs/user-manual/modules/ROOT/pages/component.adoc b/docs/user-manual/modules/ROOT/pages/component.adoc index 8df1da5c963..a29642e31df 100644 --- a/docs/user-manual/modules/ROOT/pages/component.adoc +++ b/docs/user-manual/modules/ROOT/pages/component.adoc @@ -1,6 +1,5 @@ = Components -// suppress inspection "GrazieInspection" Components are a fundamental building block of Apache Camel and are used to connect routes to a wide variety of external systems and services. Camel comes with a large number of built-in components that provide connectivity to a wide range of technologies and protocols, such as HTTP, JMS, file, and many others. You can also create a custom components if the built-in components do not meet your needs. == Components: the basics diff --git a/docs/user-manual/modules/ROOT/pages/java-dsl.adoc b/docs/user-manual/modules/ROOT/pages/java-dsl.adoc index 7518917ad80..7e732f1d52c 100644 --- a/docs/user-manual/modules/ROOT/pages/java-dsl.adoc +++ b/docs/user-manual/modules/ROOT/pages/java-dsl.adoc @@ -2,8 +2,7 @@ Apache Camel offers a Java based DSL. -The Java DSL is available by extending the `RouteBuilder` class, -and implement the `configure` method. +In the Java DSL you create a route by extending the xref:manual::route-builder.adoc[`RouteBuilder` class], and implementing the `configure` method. == Java DSL example @@ -62,6 +61,22 @@ Then we use the xref:components:eips:choice-eip.adoc[Content Based Router] EIP .to("file:target/messages/others"); ------------------------------------------------------- +=== Routes using Java lambda style + +Camel now supports to define Camel routes in Java DSL using Lambda style. This can be beneficial for microservices or serverless where +you may want to quickly define a few routes. + +For example using lambda style you can define a Camel route that takes messages from Kafka and send to JMS in a single line of code: + +[source,java] +---- +rb -> rb.from("kafka:cheese").to("jms:queue:foo"); +---- + +There is a bit more to this as the lambda route must be coded in a Java method that returns an instance of `LambdaRouteBuilder`. +See more at the xref:lambda-route-builder.adoc[LambdaRouteBuilder] documentation. + + == More Details For more details see xref:dsl.adoc[DSL], xref:routes.adoc[Routes], and xref:processor.adoc[Processor]. diff --git a/docs/user-manual/modules/ROOT/pages/routes.adoc b/docs/user-manual/modules/ROOT/pages/routes.adoc index e47c0f7f8b2..faa12aba92d 100644 --- a/docs/user-manual/modules/ROOT/pages/routes.adoc +++ b/docs/user-manual/modules/ROOT/pages/routes.adoc @@ -25,10 +25,11 @@ Camel _routes_ can be defined using a variety of xref:dsl.adoc[domain-specific l ---- -== RouteBuilder with Java DSL +== Writing Routes in Java using the Java DSL -When coding routes with the xref:java-dsl.adoc[Java DSL] then you would use a xref:route-builder.adoc[`RouteBuilder`] classes where -you code the route in the `configure` method as shown: +You can create a route using the Java language by extending the xref:manual::route-builder.adoc[`RouteBuilder` class], and implementing the `configure` method. + +Here's an example: [source,java] ------------------------------------------------------ @@ -39,28 +40,15 @@ RouteBuilder builder = new RouteBuilder() { }; ------------------------------------------------------ -As you can see from the above Camel uses URIs to wire endpoints together. - -=== Routes using Java lambda style - -Camel now supports to define Camel routes in Java DSL using Lambda style. This can be beneficial for microservices or serverless where -you may want to quickly define a few routes. - -For example using lambda style you can define a Camel route that takes messages from Kafka and send to JMS in a single line of code: - -[source,java] ----- -rb -> rb.from("kafka:cheese").to("jms:queue:foo"); ----- +As you can see from the code snippet above, Camel uses xref:manual::uris.adoc[URIs] to wire endpoints together. -There is a bit more to this as the lambda route must be coded in a Java method that returns an instance of `LambdaRouteBuilder`. -See more at the xref:lambda-route-builder.adoc[LambdaRouteBuilder] documentation. +We refer to this way of writing route as using the xref:manual::java-dsl.adoc[Java DSL]. == Route Precondition -The routes can be included or not according to the result of a test expressed in simple language that is evaluated only once during the initialization phase. +The routes can be included or not according to the result of a test. You can express the condition for the tests using the simple language. Camel evaluates this condition only once during the initialization phase. -In the next example, the route is only included if the parameter `format` has been set to `xml`. +Here's an example that includes the route only if the parameter `format` has been set to `xml`: [source,java] ---- @@ -69,7 +57,7 @@ from("direct:in").precondition("'{{format}}' == 'xml'") .to("direct:out"); ---- -And the same example using XML DSL: +You can write the same route described above using the xref:components:others:java-xml-io-dsl.adoc[XML DSL]: [source,xml] ---- @@ -80,7 +68,7 @@ And the same example using XML DSL: </route> ---- -And in YAML DSL: +You can also write the same route described above using the xref:components:others:yaml-dsl.adoc[YAML DSL]: [source,yaml] ---- @@ -96,4 +84,4 @@ And in YAML DSL: == More Information -See xref:route-builder.adoc[RouteBuilder] and xref:dsl.adoc[DSL] for a list of supported languages you can use for coding Camel routes. +Check the xref:dsl.adoc[list of supported languages] that you can use for writing Camel routes. diff --git a/docs/user-manual/modules/ROOT/pages/uris.adoc b/docs/user-manual/modules/ROOT/pages/uris.adoc index 759066541f2..58df63d9349 100644 --- a/docs/user-manual/modules/ROOT/pages/uris.adoc +++ b/docs/user-manual/modules/ROOT/pages/uris.adoc @@ -1,8 +1,8 @@ = URIs -Camel makes extensive use of URIs to allow you to refer to xref:endpoint.adoc[Endpoint]s. +Camel makes extensive use of URIs to allow you to refer to xref:endpoint.adoc[Endpoints]. -For example the following URI: +For example, consider the following URI: [source,text] ---- @@ -11,17 +11,13 @@ kafka:cheese?brokers=mykafka:1234&clientId=foo This endpoint is created by the xref:components::kafka-component.adoc[Kafka] component. The URI contains endpoint configurations as context-path and query parameters. -In this example the context-path is `cheese` which is the kafka topic to use. +In this example, the context-path is `cheese` which is the kafka topic to use. The query parameters have two parameters: -- `brokers=mykafka:1234` which is the remote Kafka broker to connect to. -- `clientId=foo` is the client id +1. `brokers=mykafka:1234`: the remote Kafka broker to connect to. +2. `clientId=foo`: the client id, which is a configuration of the Kafka component -Make sure to read -xref:faq:how-do-i-configure-endpoints.adoc[How do I configure endpoints] -to learn more about configuring endpoints. For -example how to refer to beans in the xref:registry.adoc[registry] or how -to use raw values for password options, and using -xref:using-propertyplaceholder.adoc[property placeholders], or how to use -the type safe xref:Endpoint-dsl.adoc[Endpoint DSL] and xref:dataformat-dsl.adoc[DataFormat DSL]. +== More Information + +You can read the guide xref:faq:how-do-i-configure-endpoints.adoc[How do I configure endpoints] to learn more about configuring _endpoints_. Among other things, this guide explains how to refer to beans in the xref:registry.adoc[registry], how to use raw values for password options, how to use xref:using-propertyplaceholder.adoc[property placeholders], or how to use the type safe xref:Endpoint-dsl.adoc[Endpoint DSL] and xref:dataformat-dsl.adoc[DataFormat DSL].
