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

commit cffd737b0cfb7641dba00be5fcc4124dd744ca2b
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Aug 6 10:39:36 2021 +0200

    CAMEL-16844: Make it more clear how to configure components with options on 
two levels.
---
 .../camel/maven/packaging/UpdateReadmeMojo.java    |  5 +++-
 .../main/resources/component-configure-header.mvel | 32 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
index 669d9de..6817577 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
@@ -201,7 +201,10 @@ public class UpdateReadmeMojo extends 
AbstractGeneratorMojo {
                         option.setDescription(desc);
                     });
 
-                    String options = 
evaluateTemplate("component-options.mvel", model);
+                    String options = 
evaluateTemplate("component-configure-header.mvel", model);
+                    updated |= updateOptionsIn(file, kind + "-configure", 
options);
+
+                    options = evaluateTemplate("component-options.mvel", 
model);
                     updated |= updateOptionsIn(file, kind, options);
 
                     options = evaluateTemplate("endpoint-options.mvel", model);
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/resources/component-configure-header.mvel
 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-configure-header.mvel
new file mode 100644
index 0000000..b97d170
--- /dev/null
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/resources/component-configure-header.mvel
@@ -0,0 +1,32 @@
+== Configuring Options
+
+Camel components are configured on two separate levels:
+
+- component level
+- endpoint level
+
+=== Configuring Component Options
+
+The component level is the highest level which holds general and common 
configurations that are inherited by the endpoints.
+For example a component may have security settings, credentials for 
authentication, urls for network connection and so forth.
+
+Some components only have a few options, and others may have many. Because 
components typically have pre configured defaults
+that are commonly used, then you may often only need to configure a few 
options on a component; or none at all.
+
+Configuring components can be done with the xref:component-dsl.adoc[Component 
DSL], in a configuration file (application.properties|yaml), or
+directly with Java code.
+
+=== Configuring Endpoint Options
+
+Where you find yourself configuring the most is on endpoints, as endpoints 
often have many options, which allows you to
+configure what you need the endpoint to do. The options are also categorized 
into whether the endpoint is used as consumer (from)
+or as a producer (to), or used for both.
+
+Configuring endpoints is most often done directly in the endpoint URI as path 
and query parameters. You can also use
+the xref:Endpoint-dsl.adoc[Endpoint DSL] as a _type safe_ way of configuring 
endpoints.
+
+A good practice when configuring options is to use 
xref:using-propertyplaceholder.adoc[Property Placeholders],
+which allows to not hardcode urls, port numbers, sensitive information, and 
other settings.
+In other words placeholders allows to externalize the configuration from your 
code, and gives more flexibility and reuse.
+
+The following two sections lists all the options, firstly for the component 
followed by the endpoint.

Reply via email to