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 1e4a4bd Create Endpoint-dsl.adoc (#3642) 1e4a4bd is described below commit 1e4a4bd6c5b19455ce97366955ac084e92e0de34 Author: rimshach <44733143+rimsh...@users.noreply.github.com> AuthorDate: Mon Mar 16 22:19:55 2020 -0700 Create Endpoint-dsl.adoc (#3642) --- .../modules/ROOT/pages/Endpoint-dsl.adoc | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc b/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc new file mode 100644 index 0000000..5e3ddbc --- /dev/null +++ b/docs/user-manual/modules/ROOT/pages/Endpoint-dsl.adoc @@ -0,0 +1,50 @@ +[[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 + +The following is an example of an FTP consumer endpoint definition: + +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) + + .advanced() + + .ftpClientParameters( + + Collections.singletonMap("dataTimeout", 30000)) + + .ftpClientConfig( + + Collections.singletonMap("serverLanguageCode", "fr"))) + + .to(bean("something")); + +=== 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. + +== How to access? + +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.