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
The following commit(s) were added to refs/heads/master by this push: new c583be3 Polished c583be3 is described below commit c583be3d50798a8f6669b31d4061225c15a89a3d Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Mar 17 06:47:33 2020 +0100 Polished --- .../modules/ROOT/pages/Endpoint-dsl.adoc | 54 ++++++++-------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc b/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc index 5e3ddbc..8989d07 100644 --- a/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc +++ b/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc @@ -1,50 +1,36 @@ -[[ENDPOINT-DSL]] -= ENDPOINT DSL +[[Endpoint-DSL]] += Endpoint DSL -Endpoint-dsl is a new API that is created to replace already being used URLs to designate the consumer or producer endpoints. - -== How Endpoint-dsl is better than URLs? - -=== Simple and easy to read/understand +Endpoint-dsl is a new API that allows to use type-safe endpoint URL configurations. The following is an example of an FTP consumer endpoint definition: -from("ftp://foo@myserver?password=secret& - - recursive=true& - +[source,java] +---- +from("ftp://foo@myserver?password=secret&recursive=true& ftpClient.dataTimeout=30000& - ftpClientConfig.serverLanguageCode=fr") - .to("bean:doSomething"); +---- -The same java statement can be rewritten in the following more readable way: - -from(ftp("myserver").account("foo") - - .password("secret") - - .recursive(true) +The same Java statement can be rewritten in the following more readable way: +[source,java] +---- +from(ftp("myserver").account("foo").password("secret").recursive(true) .advanced() - - .ftpClientParameters( - - Collections.singletonMap("dataTimeout", 30000)) - - .ftpClientConfig( - - Collections.singletonMap("serverLanguageCode", "fr"))) - + .ftpClientParameters(Collections.singletonMap("dataTimeout", 30000)) + .ftpClientConfig(Collections.singletonMap("serverLanguageCode", "fr"))) .to(bean("something")); +---- + +== The fluent DSL now provides type safety for parameters: -=== The fluent DSL now provides type safety for parameters : The above example of endpoint-dsl uses the meta model, which is extracted from the source using an annotation processor and written in various JSON files, to generate a fluent DSL for each endpoint.This fluent DSL provides type safety for parameters. -It further allows leveraging the java editor code completion to access the list of available parameters for the each endpoint. +It further allows leveraging the Java editor code completion to access the list of available parameters for the each endpoint. -== How to access? +== How to use -The DSL can be accessed in several ways, but the main one is to switch to using an EndpointRouteBuilder instead of the usual -RouteBuilder. It provides access to all endpoint builders which are defined through inheritance on the EndpointRouteBuilder. +The DSL can be accessed in several ways, but the main one is to switch to using an `EndpointRouteBuilder` instead of the usual +`RouteBuilder`. It provides access to all endpoint builders which are defined through inheritance on the `EndpointRouteBuilder`.