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
The following commit(s) were added to refs/heads/main by this push:
new e00692f CAMEL-16861: Cleanup docs
e00692f is described below
commit e00692ff424b2447aa77475bff2dbc4005074ab0
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 1 18:56:18 2021 +0100
CAMEL-16861: Cleanup docs
---
.../modules/ROOT/pages/component-dsl.adoc | 32 ++++++----------------
1 file changed, 8 insertions(+), 24 deletions(-)
diff --git a/docs/user-manual/modules/ROOT/pages/component-dsl.adoc
b/docs/user-manual/modules/ROOT/pages/component-dsl.adoc
index 8916522..aa6f6a6 100644
--- a/docs/user-manual/modules/ROOT/pages/component-dsl.adoc
+++ b/docs/user-manual/modules/ROOT/pages/component-dsl.adoc
@@ -1,6 +1,10 @@
= Component DSL
-Component-DSL is a new API that allows using type safe construction of Camel
components and inject them directly to Camel Context instead of initializing
through a constructor.
+Component-DSL is a builder API that allows using type safe construction of
+Camel xref:component.adoc[Components] and inject them directly to
xref:camelcontext.adoc[CamelContext]
+instead of initializing through a constructor.
+
+== Using Component DSL
The following is an example of Kafka component that is constructed using the
typical constructor initialization:
@@ -27,33 +31,13 @@ In order to explain it better, we can break down the above
Java statement into 3
. `.brokers("{{kafka.host}}:{{kafka.port}}")`: This is the equivalent setter
of `kafka.setBrokers("localhost:9090")` using DSL fluent builder.
. `.register(camelContext, "kafka")`: Here we register directly the component
under name `kafka` into Camel context, of course you can use any component name
you like, just like `addComponent` API.
-== The fluent DSL now provides type safety for parameters
+=== Type Safety
-Similar to the Endpoint DSL, uses the meta model, which is extracted from the
source using an annotation processor and
+Similar to the xref:Endpoint-dsl.adoc[Endpoint DSL], uses the meta-model,
which is extracted from the source and
written in various JSON files, to generate a fluent DSL for each component.
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 component.
-
-== Build component without registering into Camel context
-In the above Java statement, we registered the component directly into Camel
context. However, the Component DSL also allows you to just build the component
and return the object instance, for example:
-
-[source,java]
-----
-KafkaComponent kafka = ComponentsBuilderFactory.kafka()
- .brokers("{{kafka.host}}:{{kafka.port}}")
- .build(camelContext);
-----
-
-In the above Java statement, the context was passed into the `build` API in
order to resolve any placeholders that are assigned in the context, e.g:
`{{kafka.host}}:{{kafka.port}}`. However, if you don't have any placeholders or
don't need to have the component closely connected to the Camel context, this
can be done as follows:
-
-[source,java]
-----
-KafkaComponent kafka = ComponentsBuilderFactory.kafka()
- .brokers("{{kafka.host}}:{{kafka.port}}")
- .build();
-----
-== How to use
+== Dependency
In order to use this feature, Maven users will need to add the following
dependency to their `pom.xml` for this component: