Posts

Showing posts from December, 2019

Camel Endpoint DSL

Image
Camel Endpoint DSL One of the new features of Camel 3.0 is an Endpoint DSL.  This new API aims to provide a type safe replacement for the URLs that are used in Camel to designate the consumer or producer endpoints.  These URLs provide 3 things: the scheme of the URL identifies the component to use, a unique name or id for the endpoint, and a set of parameters to customize the endpoint behavior.

Here 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");
There are several drawbacks with such constructs : no type safety, bad readability and no simple completion.

So we now use the meta model, which is currently extracted from the source using an annotation processor and written in various JSON files, to generate a fluent DSL for each endpoint.  The same java statement can b…